Answer the question
In order to leave comments, you need to log in
Coexistence of NGINX and Apache on port 80 - is it possible?
Good day.
I have a server on CentOS with Apache installed.
Is it possible to configure NGINX and Apache so that NGINX is only responsible for serving static files (jpg|jpeg|gif|png|svg|js|css|swf), and Apache is still responsible for everything else?
Answer the question
In order to leave comments, you need to log in
We hang up apache on 8080 for example.
And nginx is configured like this
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://domain.com:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
location ~* \.(jpg|jpeg|gif|png|svg|js|css|swf)$ {
root /var/www/html/domain.com;
}
}
If there is a second ip, then hang the statics on another domain / subdomain and set up the return there. They cannot exist together on the same IP and port.
No. But you don't need it, it's enough to forward "everything else" to Apache.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question