Last active
April 13, 2017 02:04
-
-
Save grokdesigns/d43fdee967768dee79d70dae58962262 to your computer and use it in GitHub Desktop.
Atkailash NGINX
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 | |
{ | |
listen 80; | |
server_name DOMAIN1.COM; | |
root /usr/local/nginx/html; | |
index index.php index.html index.htm; | |
access_log logs/www.access.log; | |
location ~ \.php$ | |
{ | |
try_files $uri =404; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
} | |
location / | |
{ | |
try_files $uri $uri/ =404; | |
} | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html | |
{ | |
root html; | |
} | |
} | |
server | |
{ | |
listen 80; | |
server_name WWW.DOMAIN1.COM; | |
root /usr/local/nginx/html; | |
index index.html index.htm; | |
access_log logs/www.access.log; | |
location / | |
{ | |
try_files $uri $uri/ =404; | |
} | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html | |
{ | |
root html; | |
} | |
} | |
#HTTPS server | |
server | |
{ | |
listen 443 ssl; | |
server_name SUB.DOMAIN1.COM; | |
ssl_certificate /etc/letsencrypt/live/SUB.DOMAIN1.COM/cert.pem; | |
ssl_certificate_key /etc/letsencrypt/live/SUB.DOMAIN1.COM/privkey.pem; | |
ssl_trusted_certificate /etc/letsencrypt/live/SUB.DOMAIN1.COM/chain.pem; | |
include ssl-params.conf; | |
root /usr/local/nginx/html; | |
index index.html index.htm; | |
location / | |
{ | |
try_files $uri $uri/ =404; | |
} | |
} | |
server | |
{ | |
listen 443 ssl http2 default_server; | |
server_name DOMAIN2.TLD; | |
ssl on; | |
ssl_certificate /usr/local/nginx/DOMAIN2.TLD.pem; | |
ssl_certificate_key /usr/local/nginx/DOMAIN2.TLD-priv.key; | |
ssl_trusted_certificate /usr/local/nginx/DOMAIN2.TLD-chain.pem; | |
include ssl-params.conf; | |
location /static/ | |
{ | |
alias /var/www/DOMAIN2.TLD/static/; | |
} | |
location / | |
{ | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-proto http; | |
proxy_connect_timeout 10; | |
proxy_read_timeout 10; | |
proxy_pass http://localhost:8000/; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment