http to https not working.
December 04, 2019 07:57AM
Hello. i installed nginx version: nginx/1.16.1
created virtual host and added both http and https. when i want to enter app without https, it does not work. but when i add https to app address it works. my virtual host conf:
server {
listen ip address:80;
server_name domain_name;
return 301 https://$server_name$request_uri;
}



server {
listen ip_address:4433;
server_name domain name;
root /var/www/app_name/public;
index index.php index.html index.htm;
ssl on;

ssl_certificate /etc/nginx/ssl/cert-2.cer;

ssl_certificate_key /etc/nginx/ssl/private2.key;
Re: http to https not working.
May 15, 2020 06:22AM
Hi Araz,

have you managed to resolve this? I have exactly the same issue and have been going through the internet like mad but the suggestions do not work.

Marius
Re: http to https not working.
August 16, 2020 10:04PM
This is working to me: I am using windows:
http {
rewrite_log on;
include 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"';

sendfile on;
#access_log logs/access.log main;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;

# Enable SSL
ssl_certificate ../ssl/cert.pem;
ssl_certificate_key ../ssl/key.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;

server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
include sites-available/*.conf;
}
//conf folder
//file: ges.conf
server {
listen 443 ssl;
server_name ges.myapp.local;

#folder vue com index.html - comumn a todos nao muda
include proxy_static.locations;


location ~ ^/(domapi|otherapi)/ {
#access_log off;
#resolver 127.0.0.1; make no difference
proxy_pass http://127.0.0.1:3000$request_uri;
}

#api node - apontar para o folder com o node do cliente
#muda de acordo com cliente
location ~ ^/(api|uploads|public)/ {
#access_log off;
proxy_pass http://localhost:3001$request_uri;
}

#socket io - apontar para o folder com o node do cliente
#muda de acordo com cliente
location ~* \.io {
access_log off;
include proxy_io_params.conf;
proxy_pass http://localhost:3001;
}



error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Re: http to https not working.
October 05, 2020 09:19PM
jwest Wrote:
-------------------------------------------------------
> This is working to me: I am using windows:
> http {
> rewrite_log on;
> include 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"';
>
> sendfile on;
> #access_log logs/access.log main;
> #tcp_nopush on;
> #keepalive_timeout 0;
> keepalive_timeout 65;
> gzip on;
>
> # Enable SSL
> ssl_certificate ../ssl/cert.pem;
> ssl_certificate_key ../ssl/key.pem;
.
> ssl_session_timeout 5m;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> ssl_ciphers
> ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
> ssl_prefer_server_ciphers on;
> https://juicewrldmerchandise.net/
> server {
> listen 80;
> listen [::]:80;
> return 301 https://$host$request_uri;
> }
> include sites-available/*.conf;
> }
> //conf folder
> //file: ges.conf
> server {
> listen 443 ssl;
> server_name ges.myapp.local;
>
> #folder vue com index.html - comumn a todos nao muda
> include proxy_static.locations;
>
>
> location ~ ^/(domapi|otherapi)/ {
> #access_log off;
> #resolver 127.0.0.1; make no difference
> proxy_pass http://127.0.0.1:3000$request_uri;
> }
>
> #api node - apontar para o folder com o node do cliente
> #muda de acordo com cliente
> location ~ ^/(api|uploads|public)/ {
> #access_log off;
> proxy_pass http://localhost:3001$request_uri;
> }
>
> #socket io - apontar para o folder com o node do cliente
> #muda de acordo com cliente
> location ~* \.io {
> access_log off;
> include proxy_io_params.conf;
> proxy_pass http://localhost:3001;
> }
>
>
>
> error_page 500 502 503 504 /50x.html;
> location = /50x.html {
> root html;
> }
> }

It worked for me. Thanks bro.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready