<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><font size="2"><font face="verdana, helvetica, sans-serif">Hi,<br><br>I am writing this to hopefully get some help of you gus after struggeling with this issue in a few days.<br><br>I will try to describe the issue as short as pssible.<br><br>Ok, my website runs just fine on 443 and 80 with the lastest version on nginx. (thx Igor and Nginx team!)<br><br>The problem started when I tried to put varnish (port 80) in front of Nginx (port 81).<br><br>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)<br><br>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 <span
style="background-color: #000000;"><strong><span style="background-color: #ffffff;"><font color="#ff0000">/usr/local/nginx/html/index.htm</font></span></strong></span> instead of </font></font><font size="2"><font face="verdana, helvetica, sans-serif"><span style="background-color: #ff0000;"><span style="background-color: #ffffff;"><strong><font color="#2d2d2d">/var/www/domain.com/index.php</font></strong></span></span></font></font><font size="2"><font face="verdana, helvetica, sans-serif"><br><br>lsof -i tcp:80<br>nginx 1071 root 10u IPv4 4296 0t0 TCP *:www (LISTEN)<br>nginx 1073 www-data 10u IPv4 4296 0t0 TCP *:www (LISTEN)<br>nginx 1074 www-data 10u IPv4 4296 0t0 TCP *:www (LISTEN)<br>nginx 1075 www-data 10u IPv4 4296 0t0 TCP *:www (LISTEN)<br>varnishd 1093 nobody 6u IPv6 4347 0t0 TCP *:www (LISTEN)<br><br>lsof -i tcp:81<br>nginx 1071 root 8u IPv4 4294 0t0
TCP *:81 (LISTEN)<br>nginx 1073 www-data 8u IPv4 4294 0t0 TCP *:81 (LISTEN)<br>nginx 1074 www-data 8u IPv4 4294 0t0 TCP *:81 (LISTEN)<br>nginx 1075 www-data 8u IPv4 4294 0t0 TCP *:81 (LISTEN)<br><br>here is my config files<br><br>user www-data;<br>worker_processes 1;<br>error_log /var/log/nginx/error.log warn;<br>pid /var/run/nginx.pid;<br>events {<br> worker_connections 1024;<br>}<br>http {<br>set_real_ip_from 127.0.0.1;<br>real_ip_header X-Forwarded-For;<br> include /etc/nginx/mime.types;<br> default_type application/octet-stream;<br>sendfile on;<br>include /etc/nginx/conf.d/*.conf;<br> port_in_redirect off;<br>}<br><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<br><strong>default</strong><br>server {<br> listen 81 default; ## listen for ipv4<br>
set_real_ip_from 127.0.0.1;<br> real_ip_header X-Forwarded-For;<br> server_name _;<br> root /var/www/domain.com;<br>location / {<br> root /var/www/defaultdir;<br> index index.php index.html index.htm;<br> }<br>location ~ \.php$ {<br>fastcgi_pass 127.0.0.1:9000;<br>fastcgi_index index.php;<br>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br>include fastcgi_params;<br>}<br>}<br><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</font></font></div><div style="color: rgb(255, 0, 0); font-size: 13px; font-family: "Verdana"; background-color: transparent; font-style: normal; font-weight: 700"><strong><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif">domain.com<br></font></font></font></strong></div><div style="font-size: 13px; background-color:
transparent; font-style: normal; font-weight: 700; color: rgb(45, 45, 45); font-family: "Verdana""><strong><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif"><br></font></font></font></strong></div><div style="font-size: 13px; background-color: transparent; font-style: normal; font-weight: 700; color: rgb(45, 45, 45); font-family: "Verdana""><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif">server {<br> server_name .domain.com;<br> root /var/www/domain.com;<br> listen 81;<br> set_real_ip_from 127.0.0.1;<br> real_ip_header X-Forwarded-For;<br> listen 443 ssl;<br> {SSL stuffs goes here}<br><br> location / {<br> index index.php index.html index.htm;<br> access_log off;<br> error_log off;<br> }<br> location ~ \.php$ {<br> fastcgi_pass 127.0.0.1:9000;<br>
fastcgi_index index.php;<br> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br> include fastcgi_params;<br> fastcgi_param HTTPS on;<br><br> }<br> }</font></font></font><font color="#000000"><br></font></div><div style="font-size: 13px; background-color: transparent; font-style: normal; font-weight: 700; color: rgb(45, 45, 45); font-family: "Verdana""><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif"><br></font></font></font></div><div style="font-size: 13px; background-color: transparent; font-style: normal; font-weight: 700; color: rgb(45, 45, 45); font-family: "Verdana""><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif">I would appreciate any help I can get with this issue.</font></font></font></div><div style="font-size: 13px; background-color: transparent; font-style: normal; font-weight:
700; color: rgb(45, 45, 45); font-family: "verdana", "helvetica", sans-serif"><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif"><br></font></font></font></div><div style="font-size: 13px; background-color: transparent; font-style: normal; font-weight: 700; color: rgb(45, 45, 45); font-family: "Verdana""><font color="#2d2d2d"><font size="2"><font face="verdana, helvetica, sans-serif">Best regards, Mat <br></font></font></font></div></div></body></html>