Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fastcgi_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
- fastcgi_cache_key "$scheme$request_method$host$request_uri";
- upstream remote_fpm {
- server php-fpm:9000;
- # least_conn = round-robin
- }
- server {
- listen 80;
- listen [::]:80;
- charset utf-8;
- server_name 127.0.0.1 localhost felix-windows;
- root /var/www/public;
- index index.html index.htm index.php;
- error_log /var/log/nginx/error.log;
- access_log /var/log/nginx/access.log;
- location ~ \.php$ {
- try_files $uri =404;
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass remote_fpm;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_intercept_errors off;
- fastcgi_buffer_size 16k;
- fastcgi_buffers 4 16k;
- fastcgi_connect_timeout 600;
- fastcgi_send_timeout 600;
- fastcgi_read_timeout 600;
- include fastcgi_params;
- # fastcgi_cache my_zone;
- fastcgi_cache_valid 200 60m; # Only cache 200 responses, cache for 60 minutes
- fastcgi_cache_methods GET HEAD; # Only GET and HEAD methods apply
- add_header X-Fastcgi-Cache $upstream_cache_status;
- fastcgi_cache_bypass $http_cache_control; # Don't pull from cache based on $no_cache
- fastcgi_no_cache $http_cache_control; # Don't save to cache based on $no_cache
- }
- location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
- expires max;
- log_not_found off;
- }
- location = /favicon.ico {
- access_log off;
- log_not_found off;
- }
- location = /robots.txt {
- access_log off;
- log_not_found off;
- }
- location ~ /\.(?!well-known).* {
- deny all;
- }
- location / {
- try_files $uri $uri/ /index.php?$query_string;
- add_header X-Proxy-Cache $upstream_cache_status;
- gzip_static on;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement