Answer the question
In order to leave comments, you need to log in
How to properly organize nginx configuration?
Hello, help me solve a small problem on setting up nginx.
In general, there is such a php application structure
/home/WebRoot/ecommerce/
/home/WebRoot/ecommerce/domains
/home/WebRoot/ecommerce/domains/example.com/www - statics
/home/WebRoot/ecommerce/bootstrap.php
You need to teach nginx look for statics and if not found send everything to bootstrap.php
Here is the current configuration:
server {
listen 80;
server_name example.com;
charset utf-8;
root /home/WebRoot/ecommerce/;
location / {
try_files /domains/example.com/www$uri /domains/example.com/www$uri/ /bootstrap.php?$args;
}
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
access_log off;
#expires 1m;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param APP_ENV local;
fastcgi_param APP_DOMAIN example.com;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
Add
location = / {
try_files /domains/example.com/www/index.html /bootstrap.php?$args;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question