Skip to content

Instantly share code, notes, and snippets.

@eddywebs
Last active January 4, 2016 07:09
Show Gist options
  • Save eddywebs/8587204 to your computer and use it in GitHub Desktop.
Save eddywebs/8587204 to your computer and use it in GitHub Desktop.
nginx config file to route different urls to different apps in host -SEO
# wordpress over fastcgi
server {
listen 81;
server_name _;
root /mnt/apps/airpair-blog/current;
index index.html index.php /index.php;
# restricting all dot files
location ~ /\. { return 403; }
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~ \.php$ {
include fastcgi_params;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
}
server {
listen 80;
server_name _;
# Home page is node.js app
location = / {
proxy_pass http://airpair-com-prod.herokuapp.com;
}
# Node.js
location /find-an-expert {
proxy_pass http://airpair-com-prod.herokuapp.com;
}
# another node Node.js
location /login {
proxy_pass http://airpair-com-prod.herokuapp.com;
}
# rest to wordpress
location / {
proxy_set_header Host $proxy_host:80;
proxy_pass http://127.0.0.1:81;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment