<div dir="ltr">Hello,<div><br></div><div>I have installed and configured nginx for a existing domain, but I get "it works" at the browser.</div><div><br></div><div>I have changed all port from 80 to 8080 in apache vhost and create same vhost in /etc/nginx/vhosts.d/mydomain.conf as below</div>
<div><br></div><div><div>server {</div><div> listen 80; # Default listen port</div><div> server_name <a href="http://site.mydomain.com">site.mydomain.com</a>;</div><div> access_log /var/log/nginx/<a href="http://dustri.de">dustri.de</a>;</div>
<div> gzip on; # Turn on gZip</div><div> gzip_disable msie6;</div><div> gzip_static on;</div><div> gzip_comp_level 9;</div><div> gzip_proxied any;</div><div> gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;</div>
<div><br></div><div> location / {</div><div> proxy_redirect off; # Do not redirect this proxy - It needs to be pass-through</div><div> proxy_set_header Host $host;</div><div> proxy_set_header X-Real-IP $remote_addr;</div>
<div> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</div><div> proxy_set_header X-Server-Address $server_addr;</div><div> proxy_pass_header Set-Cookie;</div><div> #proxy_pass <a href="http://127.0.0.1:6081">http://127.0.0.1:6081</a>; # Pass all traffic through to Varnish</div>
<div> proxy_pass <a href="http://127.0.0.1:8080">http://127.0.0.1:8080</a>;</div><div> }</div><div>}</div></div><div><br></div><div>obviously <a href="http://site.mydomain.com">site.mydomain.com</a> has been replaced by the actual site to visit.</div>
<div><br></div><div>What else should I configure here ?</div><div><br></div><div>Thanks</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 17, 2014 at 4:34 PM, mex <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us" target="_blank">nginx-forum@nginx.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">> Hence I have to place nginx before apache without disturbing the<br>
> setup.<br>
><br>
<br>
</div>works seemlessly and speeds up your apache, when using proxy_cache,<br>
assuming your<br>
apache listens on 8080<br>
<br>
<br>
server {<br>
listen 80;<br>
server_name myhost;<br>
location / {<br>
root /path/to/myapp/public;<br>
proxy_set_header X-Forwarded-Host $host;<br>
proxy_set_header X-Forwarded-Server $host;<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_pass <a href="http://apache:8080" target="_blank">http://apache:8080</a>;<br>
}<br>
}<br>
<br>
from this basic snippet you can go on and test different setups<br>
with additional nginx-virtualhosts before making changes work in your<br>
prod-environment<br>
<br>
<br>
server {<br>
# this is for testing new setups<br>
listen 81;<br>
server_name myhost;<br>
location / {<br>
root /path/to/myapp/public;<br>
proxy_cache cache;<br>
proxy_set_header X-Forwarded-Host $host;<br>
proxy_set_header X-Forwarded-Server $host;<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_pass <a href="http://apache:8080" target="_blank">http://apache:8080</a>;<br>
}<br>
}<br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,249356,249364#msg-249364" target="_blank">http://forum.nginx.org/read.php?2,249356,249364#msg-249364</a><br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>