You are supposed to create a new server
block and put your rewrites in it:
server {
listen 80;
server_name sub.mission13.io;
# everything else #
include /usr/share/nginx/conf/mission13.io.conf;
}
server {
listen 80 default_server;
server_name _;
root /usr/share/nginx/html/$http_host;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.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;
}
}
Of couse you can do it without a second server
block using a if
block, but that would be bad, not elegant and inefficent.
if ($http_host = sub.mission13.io) {
rewrite ^(.+)/(.+)$ /index.php?page=$1&action=$2&ajax=0;
}