Last active
June 17, 2018 13:30
-
-
Save fuale/e21ed6c5fc10fe214ad76e4278df0644 to your computer and use it in GitHub Desktop.
Nginx config examples
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 { | |
server_name [название]; | |
root [путь]; | |
index index.html index.php; | |
location / | |
{ | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ | |
{ | |
try_files $uri =404; | |
fastcgi_index index.php; | |
fastcgi_pass 127.0.0.1:9000; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
} | |
} | |
#Для автоматического поиска root директории | |
server { | |
server_name ~^(?:www\.)?(?P<host_wo_www>.+)$; | |
root [путь]/$host_wo_www; | |
index index.html index.php; #fix 403 error | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_index index.php; | |
fastcgi_pass 127.0.0.1:9000; # Сокет либо порт для Unix систем | |
#fastcgi_pass unix:/path | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment