nginx as backend
Mat Miller
matmiller33 at ymail.com
Sat Nov 3 18:18:44 UTC 2012
Hi,
I am writing this to hopefully get some help of you gus after struggeling with this issue in a few days.
I will try to describe the issue as short as pssible.
Ok, my website runs just fine on 443 and 80 with the lastest version on nginx. (thx Igor and Nginx team!)
The problem started when I tried to put varnish (port 80) in front of Nginx (port 81).
1- Of some reason I have to start Nginx before starting varnish otherwise I get bind() to 0.0.0.0:80 failed (98: Address already in use)... (yes yes I've already checked the config out and I've changed the port to 81)
2- When i start start Nginx first and varnish after, both softwares start to run, my site works just fine on 443 (https) but using http, nginx shows /usr/local/nginx/html/index.htm instead of /var/www/domain.com/index.php
lsof -i tcp:80
nginx 1071 root 10u IPv4 4296 0t0 TCP *:www (LISTEN)
nginx 1073 www-data 10u IPv4 4296 0t0 TCP *:www (LISTEN)
nginx 1074 www-data 10u IPv4 4296 0t0 TCP *:www (LISTEN)
nginx 1075 www-data 10u IPv4 4296 0t0 TCP *:www (LISTEN)
varnishd 1093 nobody 6u IPv6 4347 0t0 TCP *:www (LISTEN)
lsof -i tcp:81
nginx 1071 root 8u IPv4 4294 0t0 TCP *:81 (LISTEN)
nginx 1073 www-data 8u IPv4 4294 0t0 TCP *:81 (LISTEN)
nginx 1074 www-data 8u IPv4 4294 0t0 TCP *:81 (LISTEN)
nginx 1075 www-data 8u IPv4 4294 0t0 TCP *:81 (LISTEN)
here is my config files
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
include /etc/nginx/conf.d/*.conf;
port_in_redirect off;
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
default
server {
listen 81 default; ## listen for ipv4
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
server_name _;
root /var/www/domain.com;
location / {
root /var/www/defaultdir;
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
domain.com
server {
server_name .domain.com;
root /var/www/domain.com;
listen 81;
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
listen 443 ssl;
{SSL stuffs goes here}
location / {
index index.php index.html index.htm;
access_log off;
error_log off;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param HTTPS on;
}
}
I would appreciate any help I can get with this issue.
Best regards, Mat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20121103/89e5f1a0/attachment.html>
More information about the nginx
mailing list