G
G
German Zvonchuk2014-03-08 00:59:43
Nginx
German Zvonchuk, 2014-03-08 00:59:43

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

4 answer(s)
D
Dan Ivanov, 2014-03-08
@inside22

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;
    }
}

N
Nikita Gusakov, 2014-03-08
@hell0w0rd

Why do you need Apache if you have nginx?

E
Eugene, 2014-03-08
@Nc_Soft

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.

Y
Yuri Morozov, 2014-03-08
@metamorph

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 question

Ask a Question

731 491 924 answers to any question