Skip to content

Instantly share code, notes, and snippets.

@emiliodallatorre
Created August 13, 2021 17:15
Show Gist options
  • Save emiliodallatorre/e701dd9449dd94906d7c4251c8266e35 to your computer and use it in GitHub Desktop.
Save emiliodallatorre/e701dd9449dd94906d7c4251c8266e35 to your computer and use it in GitHub Desktop.
La mia configurazione di default per Nginx, che uso nei server con funzionalità PHP.
# server {
# listen 80;
# server_name 127.0.0.1;
# return 301 https://127.0.0.1$request_uri;
# }
server {
listen 80;
# listen 443;
# ssl on;
# ssl_certificate /etc/ssl/ssl.cert;
# ssl_certificate_key /etc/ssl/ssl.key;
root /var/www/html;
index index.php index.html index.htm;
server_name 127.0.0.1;
client_max_body_size 100M;
location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_connect_timeout 300s;
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
# include fastcgi.conf;
# include fastcgi_params;
# fastcgi_pass php;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment