Skip to content

Instantly share code, notes, and snippets.

@fataelislami
Created July 11, 2021 01:09
Show Gist options
  • Save fataelislami/7a1b5bda79d5e9885c775cff02d1fbbc to your computer and use it in GitHub Desktop.
Save fataelislami/7a1b5bda79d5e9885c775cff02d1fbbc to your computer and use it in GitHub Desktop.
Vhost nginx domain default for PHP Fpm
server {
listen 80;
listen [::]:80;
root /var/www/directory_name;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name domain.com www.domain.com;
location / {
try_files $uri $uri/ /index.php?$args;
limit_conn addr 10;
limit_req zone=one burst=50;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
limit_conn addr 30;
}
location ~ /\.ht {
deny all;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment