Created
October 27, 2016 10:06
-
-
Save alxschwarz/72b722660cf1721e4eebc031431d97bd to your computer and use it in GitHub Desktop.
sample
This file contains hidden or 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 81 http2 proxy_protocol; | |
server_name alexmak.net alexmak.yopp.in www.alexmak.net; | |
access_log /var/log/nginx/alexmak-ssl-access.log; | |
error_log /var/log/nginx/alexmak-ssl-error.log; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;preload;"; | |
location / { | |
proxy_http_version 1.1; | |
proxy_pass http://127.0.0.1:80; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header X-Forwarded-Port 81; | |
proxy_set_header Host $server_name; | |
} | |
} | |
server { | |
listen 80; | |
server_name alexmak.net www.alexmak.net; | |
root /var/www/www.alexmak.net/public_html/; | |
index index.php index.html index.htm; | |
include conf.d/drop; | |
access_log off; | |
log_not_found off; | |
error_log /var/log/nginx/alexmak-error.log; | |
port_in_redirect off; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;preload;"; | |
if ($http_x_forwarded_proto != "https") { | |
rewrite ^(.*)$ https://alexmak.net$1 permanent; | |
} | |
if (!-e $request_filename) { | |
rewrite ^/blog/[_0-9a-zA-Z-]+(/wp-.*) /blog$1 last; | |
rewrite ^/blog/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ /blog$1 last; | |
rewrite ^/blog/[_0-9a-zA-Z-]+(/.*\.php)$ /blog$1 last; | |
} | |
location / { | |
try_files $uri $uri/ /blog/index.php?q=$uri&$args; | |
} | |
location ~ \.php$ { | |
fastcgi_intercept_errors on; | |
include fastcgi_params; | |
fastcgi_buffers 256 16k; | |
fastcgi_buffer_size 128k; | |
fastcgi_connect_timeout 3s; | |
fastcgi_send_timeout 120s; | |
fastcgi_read_timeout 120s; | |
reset_timedout_connection on; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
location ~* \.(css|js|png|jpg|jpeg|gif|ico)$ { | |
expires 1d; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment