-
-
Save eksiscloud/00d77f6a4ef277bcfd6e4616f737934b to your computer and use it in GitHub Desktop.
Basic virtual host to Nginx, with page cache
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 161.35.23.171:443 ssl http2; | |
server_name eksis.dev www.eksis.dev; | |
root /var/www/eksis.dev/public_html/; | |
index index.php; | |
ssl_certificate /etc/letsencrypt/live/eksis.dev/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/eksis.dev/privkey.pem; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
if ($host = eksis.dev) { | |
return 301 https://www.$host$request_uri; | |
} | |
location ~* wp-config.php { | |
access_log /var/log/nginx/blocked.log blocked; | |
deny all; | |
} | |
location ~* xmlrpc.php { | |
access_log /var/log/nginx/blocked.log blocked; | |
allow 192.168.0.1; | |
deny all; | |
} | |
location ~* (licence|readme|license)\.(html|txt) { | |
access_log /var/log/nginx/blocked.log blocked; | |
deny all; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/run/php/php7.4-fpm.sock; | |
include fastcgi_params; | |
include snippets/fastcgi-php.conf; | |
} | |
} | |
server { | |
listen 161.35.23.171:80; | |
server_name eksis.dev www.eksis.dev; | |
access_log /var/log/nginx/access-80.log; | |
error_log /var/log/nginx/error-80.log; | |
if ($host = www.eksis.dev) { | |
return 301 https://$host$request_uri; | |
} | |
if ($host = eksis.dev) { | |
return 301 https://www.$host$request_uri; | |
} | |
return 404; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment