server {
listen 80;
server_name example.com www.example.com;
root /home/sites/example.com;
index index.php;
client_max_body_size 30M;
location / {
root /home/sites/example.com;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_ignore_client_abort on;
fastcgi_param SERVER_NAME $http_host;
}
location ~ /\.ht {
deny all;
}
}if ($host = "example.com") {
rewrite ^ $scheme://www.example.com$request_uri permanent;
}
location / {
try_files $uri $uri/ @modx-rewrite;
}return 301 $scheme://www.example.com$request_uri;
#
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/example.com/html;
index index.php index.html index.htm;
server_name example.com;
client_max_body_size 30M;
location / {
root /var/www/example.com/html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
if ($host = "example.com") {
rewrite ^ $scheme://www.example.com$request_uri permanent;
}
try_files $uri $uri/ @modx-rewrite;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_ignore_client_abort on;
fastcgi_param SERVER_NAME $http_host;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/example.com/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name example.com www.example.com;
client_max_body_size 30M;
location / {
root /var/www/example.com/html;
if ($host = "example.com") {
rewrite ^ $scheme://www.example.com$request_uri permanent;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
try_files $uri $uri/ @modx-rewrite;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_ignore_client_abort on;
fastcgi_param SERVER_NAME $http_host;
}
location ~ /\.ht {
deny all;
}
}