NGINX as Reverse Proxy works for HTTPS but not with HTTP
December 11, 2018 03:12PM

I am very new to nginx and trying to use it as a reverse proxy for my apache/php application that is behind internal load balancer with IP :
I am trying to redirect traffic that comes to my NGINX reverse proxy to the internal load balancer's IP.

When i use HTTPS configuration in proxy.conf , it works fine with self signed cert errors

but when I use non SSL version of proxy.conf and try to hit nginx reverse proxy on port 80, it does not work.

following are the contents of my file. Please help me if you can. i spent a lot of time before posting the issue here. i could not get it working.

My environment : Red Hat Enterprise Linux Server release 7.6 (Maipo) on Azure
nginx version: nginx/1.15.5
Nginx.Service : Active and Running


[root@webserver1 nginx]# vim nginx.conf
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/;

events {
worker_connections 1024;

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;

:[root@webserver1 nginx]# cd conf.d/
[root@webserver1 conf.d]# vim proxy.conf

server {
listen webserver1:443;

ssl on;
ssl_certificate /etc/nginx/ssl/proxy.pem;
ssl_certificate_key /etc/nginx/ssl/proxy.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 2m;

location / {
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;

server {
listen 80 default_server;
location / {


When it works i am hitting the URL : https://webserver1 or

I am trying to get URL : http://webserver1 or to work.

Any help is appreciated .

Re: NGINX as Reverse Proxy works for HTTPS but not with HTTP
January 21, 2019 05:02AM
i think that the use of
`ssl on`
directive is deprecated on your version of NGINX

listen 443 ssl;

is what i use on my NGINX and it works fine
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 64
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready