Last active
April 14, 2018 23:06
Star
You must be signed in to star a gist
x.blog.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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