Created
May 20, 2020 21:36
-
-
Save wernerbihl/89efd603e4ff9d418626cf294b8a7ed8 to your computer and use it in GitHub Desktop.
Nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Proxy Site | |
server { | |
listen 80 http2; | |
listen [::]:80 http2; | |
error_log /var/log/something-error.log warn; | |
index index.html index.htm; | |
server_name example.com; | |
location / { | |
proxy_pass http://127.0.0.1:6000; | |
} | |
gzip on; | |
gzip_proxied any; | |
gzip_types | |
text/css | |
text/javascript | |
application/javascript | |
application/json | |
text/xml | |
text/json; | |
} | |
// Normal Site | |
server { | |
listen 80 http2; | |
listen [::]:80 http2; | |
root /var/www; | |
index index.html index.htm index.nginx-debian.html; | |
server_name example.com www.example.com; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
gzip on; | |
gzip_proxied any; | |
gzip_types | |
text/css | |
text/javascript | |
application/javascript | |
application/json | |
text/xml | |
text/json; | |
} | |
// PHP Site | |
server { | |
listen 80; | |
listen [::]:80; | |
root /var/www; | |
index index.html index.php index.htm index.nginx-debian.html; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~ \.php$ { | |
try_files $uri /index.php =404; | |
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
gzip on; | |
gzip_proxied any; | |
gzip_types | |
text/css | |
text/javascript | |
application/javascript | |
application/json | |
text/xml | |
text/json; | |
} | |
//Enabling a site: | |
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment