nginx http to https redirect

giorgi

Verified User
Joined
Jul 27, 2021
Messages
7
hello
can someone help me? how to redirect http to https i tried to customize nginx.conf and add this

server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}

but getting error

UNABLE TO WRITE CUSTOMIZATION

nginx: [emerg] "server" directive is not allowed here in /usr/local/directadmin/data/users/admin/nginx.conf:13
nginx: configuration file /etc/nginx/nginx.conf test failed
 
Last edited:
Hello,

There is a native feature in DirectAdmin. No need to do anything manually.

User Level -> Domain Setup -> domain.com under the "private_html setup for domain.com" table, showing: [ ] Force SSL with https redirect
 
I guess you've got a firewall blocking connections. Try and disable it temporary and see whether you have access to your site.
 
port 80 is opened
when i try to telnet pitstop.ge 80 The port opens
 
Back
Top