Last active
April 24, 2018 13:45
-
-
Save mksglu/e8fcb357e6fc563fa9659468c834a123 to your computer and use it in GitHub Desktop.
CakePHP 3 and WordPress On Nginx Server - This is a simple Nginx configuration file. On the server, it will work in the WordPress sub-directory and CakePHP3 in the root directory.
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; | |
root /var/www/httdocs; | |
index index.php index.html index.htm index.nginx-debian.html; | |
server_name <server_name>; | |
add_header X-Frame-Options "SAMEORIGIN" always; | |
add_header X-XSS-Protection "1; mode=block" always; | |
add_header X-Content-Type-Options "nosniff" always; | |
add_header Referrer-Policy "no-referrer-when-downgrade" always; | |
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always; | |
gzip on; | |
gzip_vary on; | |
gzip_proxied any; | |
gzip_comp_level 6; | |
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml; | |
location /blog/ { | |
if (!-e $request_filename) { | |
rewrite ^.*$ /blog/index.php last; | |
} | |
} | |
location / { | |
try_files /webroot/$uri /webroot/$uri/ /webroot/index.php?$args; | |
} | |
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_intercept_errors on; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment