Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- if ($host = www.website.com) {
- return 301 https://$host$request_uri;
- } # managed by Certbot
- if ($host = website.com) {
- return 301 https://$host$request_uri;
- } # managed by Certbot
- listen 80;
- server_name website.com www.website.com;
- access_log /var/log/nginx/website.com.access.log;
- error_log /var/log/nginx/website.com.error.log;
- root /srv/website.com;
- client_max_body_size 100m;
- location / {
- index index.php;
- }
- location /.well-known/acme-challenge {
- root /srv/website.com/letsencrypt;
- }
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+?\.php)(/.*)$;
- if (!-f $document_root$fastcgi_script_name) {
- return 404;
- }
- # Mitigate https://httpoxy.org/ vulnerabilities
- fastcgi_param HTTP_PROXY "";
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include /etc/nginx/fastcgi_params;
- }
- }
- server {
- listen 443;
- ssl on;
- ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem; # managed by Certbot
- ssl_certificate_key /etc/letsencrypt/live/website.com/privkey.pem; # managed by Certbot
- server_name website.com www.website.com;
- access_log /var/log/nginx/ssl-website.com.access.log;
- error_log /var/log/nginx/ssl-website.com.error.log;
- root /srv/website.com;
- client_max_body_size 100m;
- #website links
- location / {
- try_files $uri $uri/ /index.php$is_args$args;
- index index.php;
- add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
- add_header Access-Control-Allow-Origin $http_origin;
- if ($request_method = OPTIONS) {
- add_header Content-Length 0;
- add_header Content-Type text/plain;
- add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
- add_header Access-Control-Allow-Origin $http_origin;
- add_header Access-Control-Allow-Headers "Authorization, Content-Type, Access-Control-Allow-Origin";
- add_header Access-Control-Allow-Credentials true;
- return 200;
- }
- }
- location /server-status {
- stub_status on;
- access_log false;
- allow 127.0.0.1;
- deny all;
- }
- location ~ [^/]\.php(/|$) {
- fastcgi_split_path_info ^(.+?\.php)(/.*)$;
- if (!-f $document_root$fastcgi_script_name) {
- return 404;
- }
- # Mitigate https://httpoxy.org/ vulnerabilities
- fastcgi_param HTTP_PROXY "";
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include /etc/nginx/fastcgi_params;
- }
- }
Add Comment
Please, Sign In to add comment