Hello,
Thanks for the reply.
Yes you are correct. I have tried to change the port from 8080 to 80 in /etc/nginx/conf.d/default.conf.
Browse the Public IP address and xyz.com site, getting “no handler found” error.
File /etc/nginx/conf.d/default.conf content as follows.
# sudo cat default.conf
## Basic reverse proxy server ##
## Apache (vm02) backend for www.example.com ##
upstream apachephp {
server Public_IP:8069; #Apache1
}
## Start www.example.com ##
server {
listen Public_IP:8080;
#server_name www.example.com;
#access_log /var/log/nginx/log/openerp;
#error_log /var/log/nginx/log/openerp.log;
#root /usr/share/nginx/html;
#index index.html index.htm;
## send request back to apache1 ##
location / {
proxy_pass http://Public_IP:8069;
#proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering 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;
}
}
File /etc/nginx/nginx.conf content as follows.
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
File /etc/nginx/sites-enabled/default contains as follows.
server {
listen 80;
server_name abc.com;
location / {
proxy_pass http://localhost:8007;
send_timeout 600;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name pqr.com;
client_max_body_size 200m;
access_log /var/log/nginx/openerp-access.log;
error_log /var/log/nginx/openerp-error.log;
#ssl on;
#ssl_certificate /etc/ssl/nginx/server.crt;
#ssl_certificate_key /etc/ssl/nginx/server.key;
#ssl_session_timeout 5m;
#ssl_prefer_server_ciphers on;
#ssl_protocols SSLv2 SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#send_timeout 10m;
proxy_max_temp_file_size 0;
client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
location /agromanager {
send_timeout 600;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_pass http://localhost:8003;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
location /web {
send_timeout 600;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_pass http://127.0.0.1:8005;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
location / {
send_timeout 600;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_pass http://127.0.0.1:8002;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name xyz.com;
location / {
proxy_pass http://localhost:8010;
send_timeout 6000;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
}
Thanks,
Imran Khan.