Help with NGINX config for Magento
Howard Barntt
lists at ruby-forum.com
Sat Mar 20 10:36:42 MSK 2010
Hi,
I have seen a similar situation here but the solution didn't work for
me. I am getting a 'NO INPUT FILE SPECIFIED' and my permanent redirect
from non-www to www doesn't seem to work.
Here is my conf file at /etc/nginx/nginx.conf
user nginx nginx;
worker_processes 6;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local]
$request '
'"$status"
$body_bytes_sent"$http_referer" '
'"$http_user_agent"
"$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript
# fastcgi nodes
upstream backend {
server unix:/tmp/fcgi.sock;
}
server {
listen 80;
server_name www.openfreeze.com;
root /var/www/html;
client_max_body_size 50M;
# protection (we have no .htaccess)
location ~
(^/magento/(app/|includes/|lib/|/pkginfo/|var/|report/config.xml)|/\.svn/|/.hta.+)
{
deny all;
}
# vhost specific access log
access_log /var/log/nginx/vhost.access.log main;
# this rewrites all the requests to the maintenance.html
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
# handle all .php files, /downloader and /report
location ~ (\.php|/downloader/?|/report/?)$ {
if ($request_uri ~ /(downloader|report)$){
# no trailing /, redirecting
rewrite ^(.*)$ $1/ permanent;
}
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (-e $request_filename) { # check if requested path exists
fastcgi_pass backend;
}
}
# magento
location / {
# set expire headers
if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)$") {
expires max;
}
# set fastcgi settings, not allowed in the .if. block
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT_NAME /index.php;
# rewrite - if file not found, pass it to the backend
if (!-f $request_filename) {
fastcgi_pass backend;
break;
}
}
}
}
HERE IS MY FASTCGI_PARAMS /etc/nginx/fastcgi_params
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
Any help will be really appreciated.
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list