mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
DOCS More resilient example domain
myapp.com is owned, example.com is specifically reserved for documentation use cases: https://en.wikipedia.org/wiki/Example.com [ci skip]
This commit is contained in:
parent
2e1e8e07b9
commit
259aa06010
@ -29,7 +29,7 @@ server {
|
||||
client_max_body_size 0; # Manage this in php.ini (upload_max_filesize & post_max_size)
|
||||
listen 80;
|
||||
root /path/to/ss/folder/public;
|
||||
server_name myapp.com www.myapp.com;
|
||||
server_name example.com www.example.com;
|
||||
|
||||
# Defend against SS-2015-013 -- http://www.silverstripe.org/software/download/security-releases/ss-2015-013
|
||||
if ($http_x_forwarded_host) {
|
||||
@ -65,7 +65,7 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
The above configuration sets up a virtual host `myapp.com` with
|
||||
The above configuration sets up a virtual host `example.com` with
|
||||
rewrite rules suited for SilverStripe. The location block for index.php
|
||||
passes the php script to the FastCGI-wrapper via a TCP socket.
|
||||
|
||||
|
@ -127,7 +127,7 @@ On your Silverstripe instance:
|
||||
|
||||
:::bash
|
||||
# Secure copy over SSH via rsync command. You may use an alternative method if desired.
|
||||
rsync -avP user@db1.myapp.com:/path/to/client/certs /path/to/secure/folder
|
||||
rsync -avP user@db1.example.com:/path/to/client/certs /path/to/secure/folder
|
||||
|
||||
# Depending on your web server configuration, allow web server to read to SSL files
|
||||
sudo chown -R www-data:www-data /path/to/secure/folder
|
||||
@ -148,7 +148,7 @@ Add or edit your `_ss_environment.php` configuration file. (See [Environment Man
|
||||
// These four define set the database connection details.
|
||||
define('SS_DATABASE_CLASS', 'MySQLPDODatabase');
|
||||
|
||||
define('SS_DATABASE_SERVER', 'db1.myapp.com');
|
||||
define('SS_DATABASE_SERVER', 'db1.example.com');
|
||||
define('SS_DATABASE_USERNAME', 'dbuser');
|
||||
define('SS_DATABASE_PASSWORD', '<password>');
|
||||
|
||||
|
@ -75,7 +75,7 @@ e.g. `/etc/nginx/sites-enabled/mysite`:
|
||||
server {
|
||||
listen 80;
|
||||
root /var/www/mysite/public;
|
||||
server_name www.myapp.com;
|
||||
server_name www.example.com;
|
||||
|
||||
error_log /var/log/nginx/mysite.error.log;
|
||||
access_log /var/log/nginx/mysite.access.log;
|
||||
|
@ -100,7 +100,7 @@ class ContactPageController extends PageController
|
||||
{
|
||||
$email = new Email();
|
||||
|
||||
$email->setTo('test@myapp.com');
|
||||
$email->setTo('test@example.com');
|
||||
$email->setFrom($data['Email']);
|
||||
$email->setSubject("Contact Message from {$data["Name"]}");
|
||||
|
||||
|
@ -340,7 +340,7 @@ values based on other fixture data.
|
||||
$factory->define('Member', [
|
||||
'Email' => function($obj, $data, $fixtures) {
|
||||
if(isset($data['FirstName']) {
|
||||
$obj->Email = strtolower($data['FirstName']) . '@myapp.com';
|
||||
$obj->Email = strtolower($data['FirstName']) . '@example.com';
|
||||
}
|
||||
},
|
||||
'Score' => function($obj, $data, $fixtures) {
|
||||
|
@ -28,7 +28,7 @@ class HomePageTest extends FunctionalTest
|
||||
|
||||
// We should see a login form
|
||||
$login = $this->submitForm("LoginFormID", null, [
|
||||
'Email' => 'test@myapp.com',
|
||||
'Email' => 'test@example.com',
|
||||
'Password' => 'wrongpassword'
|
||||
]);
|
||||
|
||||
|
@ -13,7 +13,7 @@ use SilverStripe\Control\Email\Email;
|
||||
public function MyMethod()
|
||||
{
|
||||
$e = new Email();
|
||||
$e->To = "someone@myapp.com";
|
||||
$e->To = "someone@example.com";
|
||||
$e->Subject = "Hi there";
|
||||
$e->Body = "I just really wanted to email you and say hi.";
|
||||
$e->send();
|
||||
@ -27,7 +27,7 @@ To test that `MyMethod` sends the correct email, use the [SapphireTest::assertEm
|
||||
$this->assertEmailSent($to, $from, $subject, $body);
|
||||
|
||||
// to assert that the email is sent to the correct person
|
||||
$this->assertEmailSent("someone@myapp.com", null, "/th.*e$/");
|
||||
$this->assertEmailSent("someone@example.com", null, "/th.*e$/");
|
||||
```
|
||||
|
||||
Each of the arguments (`$to`, `$from`, `$subject` and `$body`) can be either one of the following.
|
||||
|
@ -114,9 +114,9 @@ SilverStripe\Core\Injector\Injector:
|
||||
MailHandler:
|
||||
class: Monolog\Handler\NativeMailerHandler
|
||||
constructor:
|
||||
- me@myapp.com
|
||||
- me@example.com
|
||||
- There was an error on your test site
|
||||
- me@myapp.com
|
||||
- me@example.com
|
||||
- error
|
||||
properties:
|
||||
ContentType: text/html
|
||||
|
@ -450,9 +450,9 @@ given variable is done safely, with the assumption that it's an integer.
|
||||
|
||||
To cast the variable as an integer, place `(int)` or `(integer)` before the variable.
|
||||
|
||||
For example: a page with the URL paramaters *myapp.com/home/add/1* requires that ''Director::urlParams['ID']'' be an
|
||||
For example: a page with the URL paramaters *example.com/home/add/1* requires that ''Director::urlParams['ID']'' be an
|
||||
integer. We cast it by adding `(int)` - ''(int)Director::urlParams['ID']''. If a value other than an integer is
|
||||
passed, such as *myapp.com/home/add/dfsdfdsfd*, then it returns 0.
|
||||
passed, such as *example.com/home/add/dfsdfdsfd*, then it returns 0.
|
||||
|
||||
Below is an example with different ways you would use this casting technique:
|
||||
|
||||
@ -461,7 +461,7 @@ Below is an example with different ways you would use this casting technique:
|
||||
public function CaseStudies()
|
||||
{
|
||||
|
||||
// cast an ID from URL parameters e.g. (myapp.com/home/action/ID)
|
||||
// cast an ID from URL parameters e.g. (example.com/home/action/ID)
|
||||
$anotherID = (int)Director::urlParam['ID'];
|
||||
|
||||
// perform a calculation, the prerequisite being $anotherID must be an integer
|
||||
@ -612,7 +612,7 @@ this whitelist in your `.env` file, any request presenting a `Host` header that
|
||||
_not_ in this list will be blocked with a HTTP 400 error:
|
||||
|
||||
```
|
||||
SS_ALLOWED_HOSTS="www.myapp.com,myapp.com,subdomain.myapp.com"
|
||||
SS_ALLOWED_HOSTS="www.example.com,example.com,subdomain.example.com"
|
||||
```
|
||||
|
||||
Please note that if this configuration is defined, you _must_ include _all_ subdomains (eg www.)
|
||||
|
@ -130,7 +130,7 @@ You can set the default sender address of emails through the `Email.admin_email`
|
||||
|
||||
```yaml
|
||||
SilverStripe\Control\Email\Email:
|
||||
admin_email: support@myapp.com
|
||||
admin_email: support@example.com
|
||||
```
|
||||
|
||||
<div class="alert" markdown="1">
|
||||
@ -157,9 +157,9 @@ Configuration of those properties looks like the following:
|
||||
use SilverStripe\Control\Email\Email;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
if(Director::isLive()) {
|
||||
Config::modify()->set(Email::class, 'bcc_all_emails_to', "client@myapp.com");
|
||||
Config::modify()->set(Email::class, 'bcc_all_emails_to', "client@example.com");
|
||||
} else {
|
||||
Config::modify()->set(Email::class, 'send_all_emails_to', "developer@myapp.com");
|
||||
Config::modify()->set(Email::class, 'send_all_emails_to', "developer@example.com");
|
||||
}
|
||||
```
|
||||
|
||||
@ -172,7 +172,7 @@ marked as spam.
|
||||
|
||||
```php
|
||||
$email = new Email(..);
|
||||
$email->setReplyTo('reply@myapp.com');
|
||||
$email->setReplyTo('reply@example.com');
|
||||
```
|
||||
|
||||
### Setting Custom Headers
|
||||
|
@ -179,9 +179,9 @@ assets/
|
||||
|
||||
The urls for these two files, however, do not reflect the physical structure directly.
|
||||
|
||||
* `http://www.myapp.com/assets/33be1b95cb/OldCompanyLogo.gif` will be served directly from the web server,
|
||||
* `http://www.example.com/assets/33be1b95cb/OldCompanyLogo.gif` will be served directly from the web server,
|
||||
and will not invoke a php request.
|
||||
* `http://www.myapp.com/assets/a870de278b/NewCompanyLogo.gif` will be routed via a 404 handler to PHP,
|
||||
* `http://www.example.com/assets/a870de278b/NewCompanyLogo.gif` will be routed via a 404 handler to PHP,
|
||||
which will be passed to the `[ProtectedFileController](api:SilverStripe\Assets\Storage\ProtectedFileController)` controller, which will serve
|
||||
up the content of the hidden file, conditional on a permission check.
|
||||
|
||||
|
@ -74,7 +74,7 @@ This corresponds to a file with the following properties:
|
||||
- Variant: FitWzYwLDYwXQ (corresponds to Fit[60,60])
|
||||
|
||||
The URL for this file will match the physical location on disk:
|
||||
`http://www.myapp.com/assets/Uploads/b63923d8d4/BannerHeader__FitWzYwLDYwXQ.jpg`.
|
||||
`http://www.example.com/assets/Uploads/b63923d8d4/BannerHeader__FitWzYwLDYwXQ.jpg`.
|
||||
|
||||
For more information on how protected files are stored see the [file security](/developer_guides/files/file_security)
|
||||
section.
|
||||
|
@ -112,7 +112,7 @@ The above query is almost self-descriptive. It gets a user by ID, returns his or
|
||||
{
|
||||
"user": {
|
||||
"name": "Test user",
|
||||
"email": "test@myapp.com",
|
||||
"email": "test@example.com",
|
||||
"blogPosts": [
|
||||
{
|
||||
"title": "How to be awesome at GraphQL",
|
||||
|
Loading…
Reference in New Issue
Block a user