Skip to content

Instantly share code, notes, and snippets.

@duyngha
Last active July 7, 2022 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duyngha/35bd1c778dc4ecf6b973b518f2deb4b9 to your computer and use it in GitHub Desktop.
Save duyngha/35bd1c778dc4ecf6b973b518f2deb4b9 to your computer and use it in GitHub Desktop.
Nginx Configuration
# To verify Nginx's config file, type `sudo nginx -t` in terminal
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _; // _ mean any server names are accepted
root /var/www/html;
index index.php index.html index.htm;
charset utf-8;
# other configurations
location / {
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI
location ~ \.php$ {
include snippets/fastcig-php.conf;
# with php-fpm (or other UNIX sockets)
# the sock should present in that folder /run/php/
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
# with php-cgi (or other TCP sockets)
fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root concurs with Nginx's one
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment