how to configure nginx with running apache ?

Joydeep Bakshi joydeep.bakshi at netzrezepte.de
Thu Apr 17 12:48:59 UTC 2014


Hello,

I have installed and configured nginx for a existing domain, but I get "it
works" at the browser.

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

server {
 listen 80; # Default listen port
 server_name   site.mydomain.com;
 access_log /var/log/nginx/dustri.de;
 gzip on; # Turn on gZip
 gzip_disable msie6;
 gzip_static on;
 gzip_comp_level 9;
 gzip_proxied any;
 gzip_types text/plain text/css application/x-javascript text/xml
application/xml application/xml+rss text/javascript;

 location / {
  proxy_redirect off; # Do not redirect this proxy - It needs to be
pass-through
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Server-Address $server_addr;
  proxy_pass_header Set-Cookie;
  #proxy_pass http://127.0.0.1:6081; # Pass all traffic through to Varnish
 proxy_pass http://127.0.0.1:8080;
 }
}

obviously site.mydomain.com has been replaced by the actual site to visit.

What else should I configure here ?

Thanks


On Thu, Apr 17, 2014 at 4:34 PM, mex <nginx-forum at nginx.us> wrote:

> > Hence I have to place nginx before apache without disturbing the
> > setup.
> >
>
> works seemlessly  and speeds up your apache, when using proxy_cache,
> assuming your
> apache listens on 8080
>
>
> server {
>   listen 80;
>   server_name  myhost;
>   location / {
>     root /path/to/myapp/public;
>     proxy_set_header X-Forwarded-Host $host;
>     proxy_set_header X-Forwarded-Server $host;
>     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>     proxy_pass http://apache:8080;
>   }
> }
>
> from this basic snippet you can go on and test different setups
> with additional nginx-virtualhosts before making changes work in your
> prod-environment
>
>
> server {
>   # this is for testing new setups
>   listen 81;
>   server_name  myhost;
>   location / {
>     root /path/to/myapp/public;
>     proxy_cache cache;
>     proxy_set_header X-Forwarded-Host $host;
>     proxy_set_header X-Forwarded-Server $host;
>     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>     proxy_pass http://apache:8080;
>   }
> }
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,249356,249364#msg-249364
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140417/4b2722e8/attachment.html>


More information about the nginx mailing list