artmouse
★ ★ ★ ★ ★
- Регистрация
- 16 Июн 2007
- Сообщения
- 395
- Реакции
- 903
- Автор темы
- #1
Обсуждаем работу в связке nginx+php-fpm. Есть наработки? Заходи!
Пример рабочего конфига nginx для работы magento:
Пример рабочего конфига nginx для работы magento:
Код:
server {
listen 80; ## Web server port
server_name www.site.com site.com;
#server_name_in_redirect off;
if ($http_host = www.site.com) {
rewrite (.*) http://site.com$1 permanent;
}
access_log /var/log/nginx/site.com-access.log;
error_log /var/log/nginx/site.com-error.log;
root /home/site.com/www/;
## Nginx will not add the port in the url when the request is redirected.
#port_in_redirect off;
####################################################################################
## SSL CONFIGURATION
## ssl_certificate /etc/nginx/crt/site.com.pem;
## ssl_certificate_key /etc/nginx/crt/site.com.key;
## ssl_session_cache shared:SSL:15m;
## ssl_session_timeout 15m;
## ssl_protocols SSLv3 TLSv1;
## ssl_ciphers HIGH:!ADH:!EXPORT56;
## ssl_prefer_server_ciphers on;
####################################################################################
## Server maintenance block. insert dev ip 1.2.3.4 static address www.whatismyip.com
#if ($remote_addr !~ "^(1.2.3.4|1.2.3.4)$") {
#return 503;
#}
#error_page 503 @maintenance;
#location @maintenance {
#rewrite ^(.*)$ /error_page/503.html break;
#internal;
#access_log off;
#log_not_found off;
#}
####################################################################################
## 403 error log/page
#error_page 403 /403.html;
#location = /403.html {
#root /var/www/html/error_page;
#internal;
#access_log /var/log/nginx/403.log error403;
#}
####################################################################################
## Main Magento location
location / {
try_files $uri $uri/ @handler;
}
####################################################################################
## These locations would be hidden by .htaccess normally, protected
location ~ (/(app/|includes/|/pkginfo/|var/|errors/local.xml)|/\.svn/|/.hta.+) {
deny all;
#internal;
}
####################################################################################
## Protecting /admin/ and /downloader/ 1.2.3.4 = static ip (www.whatismyip.com)
location ~* ^/(downloader/|install.php)($|\/) {
auth_basic "Admin Zone";
auth_basic_user_file /var/www/ladaportal/.htpasswd;
include /etc/nginx/templates/php;
#allow 1.2.3.4;
#allow 1.2.3.4;
#deny all;
#rewrite / /@handler;
}
####################################################################################
## Images, scripts and styles set far future Expires header
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
####################################################################################
## Main Magento location
location @handler {
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
include /etc/nginx/templates/default;
include /etc/nginx/templates/php;
#include /etc/nginx/templates/phpmyadmin;
}