Created
February 7, 2016 09:16
-
-
Save tomsato/afc8a24ac0e98fc954bd to your computer and use it in GitHub Desktop.
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; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name simple-it-life.com; | |
root /var/www/vhosts/i-63a588c6; | |
index index.html index.htm; | |
charset utf-8; | |
ssl on; | |
ssl_certificate /etc/letsencrypt/live/simple-it-life.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/simple-it-life.com/privkey.pem; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers ECDHE+RSAGCM:ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:!aNULL!eNull:!EXPORT:!DES:!3DES:!MD5:!DSS; | |
ssl_dhparam /etc/nginx/ssl/dhparam.pem; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
ssl_trusted_certificate /etc/letsencrypt/live/simple-it-life.com/fullchain.pem; | |
resolver 8.8.8.8; | |
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains;'; | |
client_max_body_size 64M; | |
access_log /var/log/nginx/i-63a588c6.access.log main; | |
error_log /var/log/nginx/i-63a588c6.error.log; | |
include /etc/nginx/drop; | |
rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
#rewrite ^(.*)(index|home|default)\.html? $1 permanent; | |
set $mobile ''; | |
#include /etc/nginx/mobile-detect; | |
set $do_not_cache 0; | |
if ($http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) { | |
set $do_not_cache 1; | |
} | |
if ($request_method != GET) { | |
set $do_not_cache 1; | |
} | |
location / { | |
try_files $uri @wordpress; | |
location ~ \.php$ { | |
try_files $uri @wordpress; | |
# Pass all .php files onto a php-fpm/php-fcgi server. | |
include /etc/nginx/php-fpm; | |
} | |
} | |
location @wordpress { | |
internal; | |
proxy_no_cache $do_not_cache; | |
proxy_cache_bypass $do_not_cache; | |
proxy_redirect off; | |
proxy_cache czone; | |
proxy_cache_key "$scheme://$host$request_uri$mobile"; | |
proxy_cache_valid 200 0m; | |
proxy_pass http://backend; | |
} | |
location = /wp-admin/install.php { | |
set $script_root '/opt/local/amimoto'; | |
if ( -e /opt/local/amimoto/.valid.$server_name ) { | |
set $script_root $document_root; | |
} | |
if ( !-e /opt/local/amimoto/$fastcgi_script_name ) { | |
set $script_root $document_root; | |
} | |
expires off; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass phpfpm; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $script_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location = /wp-admin/setup-config.php { | |
set $script '/opt/local/amimoto/wp-admin/install.php'; | |
if ( -e /opt/local/amimoto/.valid.$server_name ) { | |
set $script $document_root$fastcgi_script_name; | |
} | |
if ( !-e $script ) { | |
set $script $document_root$fastcgi_script_name; | |
} | |
expires off; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass phpfpm; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $script; | |
include fastcgi_params; | |
} | |
# | |
# When you use phpMyAdmin, uncomment the line "include /etc/nginx/phpmyadmin;" | |
# and delete or comment out the below line "location ~* /(phpmyadmin|myadmin|pma) { }". | |
# | |
#include /etc/nginx/phpmyadmin; | |
location ~* /(phpmyadmin|myadmin|pma) { | |
access_log off; | |
log_not_found off; | |
return 404; | |
} | |
# | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment