I
I
Intelide2016-04-20 19:09:42
linux
Intelide, 2016-04-20 19:09:42

How to set up nginx as a frontend?

Hello, please tell me, I'm trying to install nginx as a frontend, I
moved Apache to port 8080 in httpd.conf
in /etc/nginx/conf.d/default.conf
changed

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

on the
location / {
proxy_pass 127.0.0.1:8080/;
}

In the /etc/nginx/conf.d/ directory, I created a proxy.conf file with the following content
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

restarted apache, the site started working on IPaddress:8080
when nginx is restarted,
nginx: [emerg] invalid URL prefix in /etc/nginx/conf.d/default.conf:21
nginx: configuration file /etc/nginx/nginx.conf test failed
if you comment out these lines in default.conf
location / {
proxy_pass 127.0.0.1:8080/;
}

nginx starts and gives os centos 6 start page

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-04-20
@BuriK666

proxy_pass 127.0.0.1:8080;
No slash at the end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question