Skip to content

Instantly share code, notes, and snippets.

@nguyentienlong
Last active April 14, 2018 23:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nguyentienlong/9c2a4850a2dcf27c976063e6f7736260 to your computer and use it in GitHub Desktop.
x.blog.conf
server {
root /home/example/stag/web;
server_name stag-web.example.vn www.stag-web.example.vn;
location /assets/ {
alias /home/example/stag/web/build/public/assets/;
add_header Cache-Control public;
}
location /blog {
index index.php;
try_files $uri $uri/ /index.php?$args;
rewrite ^/(.+)$ /index.php?q=$1 last;
}
location ~ .*\.php$ {
include fastcgi_params;
#include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/example/blog/wordpress$fastcgi_script_name;
}
location / {
# try_files $uri $uri/ =404;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
rewrite ^/assets(.*)$ $1 break;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_max_temp_file_size 0;
proxy_pass http://127.0.0.1:4000;
proxy_redirect off;
proxy_read_timeout 240s;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/stag-web.example.vn/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/stag-web.example.vn/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.stag-web.example.vn) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = stag-web.example.vn) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name stag-web.example.vn www.stag-web.example.vn;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment