Last active
March 7, 2023 12:17
-
-
Save ghalusa/94614f546d2ee1dc8a70 to your computer and use it in GitHub Desktop.
nginx default configuration file (ubuntu path: /etc/nginx/sites-available/default) with conversions of .htaccess environment variables and mod_rewrite logic, along with parameters supporting a fastcgi-based php setup
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
server { | |
listen 80; | |
root /var/www/YOUR_DIRECTORY; | |
index index.php index.html index.htm; | |
################################################### | |
# Change "yoururl.com" to your host name | |
server_name yoururl.com; | |
location / { | |
try_files $uri $uri/ /index.php?q=$uri&$args; | |
} | |
location /site/ { | |
if (!-e $request_filename){ | |
rewrite ^/site/(.*)$ /site/index.php break; | |
} | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param PATH_TO_FRAMEWORKS /var/www/frameworks/; | |
fastcgi_param CORE_TYPE frameworks; | |
fastcgi_param IS_DEV true; | |
include fastcgi_params; | |
} | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location ~ /\. { | |
deny all; | |
} | |
location ~* /(?:uploads|files)/.*\.php$ { | |
deny all; | |
} | |
} |
I'm having this error 502 bad gateway nginx 1.18.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this one. I was having an issue installing HVVM because of it. It seems that when instaling the fastcgi script, it looks for the default file of "sites-available" yet Ubuntu 14.04 didn't install anything, be it on aptitude or apt-get.