0

I installed apache and configured it as follows sudo vi /etc/httpd/conf/httpd.conf

Listen 127.0.0.1:8080 (changed it)

# Listen 80 (commented out this line)

Then I installed nginix The config are as follows in nginx.conf file changed user nginx; to

user apache; 

Few lines below

    server { 
        listen  80 default;
#      listen [: :]:80 default_server; (comment it out)
        server_name < i put server ip>;

location / {
             root /var/www/html;
              proxy_pass http://127.0.0.1:8080/;
              proxy_redirect off;
              proxy_set_header Host $http_host;
              proxy_set_header X-Real-IP $remote_addr;
        }

I noticed that it when i opened server ip in the browser it opens the index.html file that i placed in the www/html directory when in the location / { i only put root /var/www/html; but when i put the below lines proxy_pass http://127.0.0.1:8080/; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; and open the ip address on my browser it shows nginx error that something is not right.

Also created a proxy.conf file in /etc/nginx/conf.d directory And pasted the following lines

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;
  proxy_max_temp_file_size 0;
  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;
  • Why would you do that? I am honestly curious. – Christopher Perrin Jan 5 '18 at 1:21
  • delete root /var/www/html;. I think that twill resolve you error. And as @ChristopherPerrin ask, why you add root and proxy_pass directive in one location block? – Ilham Sulaksono Jan 13 '18 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.