I have given certificate to my site. I am using vesta panel in background. Now when I try to open the site giving https in url it opens home page but does not opens other pages… it gives 404 error. Even when try to redirect adding if ($scheme = http) { #return 301 https://$server_name$request_uri; return 301 https://chetantest.tk$request_uri; } It does redirect to https but still does not properly and not showing other pages. this is the site link: skydental.in this is my nginx.conf file:
server { listen 139.59.10.214:80; server_name skydental.in www.skydental.in; root /home/admin/web/skydental.in/public_html; index index.php index.html index.htm; access_log /var/log/nginx/domains/skydental.in.log combined; access_log /var/log/nginx/domains/skydental.in.bytes bytes; error_log /var/log/nginx/domains/skydental.in.error.log error;
location / {
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/admin/web/skydental.in/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/admin/web/skydental.in/stats/;
include /home/admin/web/skydental.in/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/admin/conf/web/nginx.skydental.in.conf*;
} Any help appriciated… please
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
@inboundRaj
It’s really best if you create two server blocks – one for Port 80 and one for Port 443. The one for Port 80 will be your redirect while the one for Port 443 is your primary and contains all the major config.
i.e.
You’d simply replace
yourdomain.ext
andwww.yourdomain.ext
with your actual domain name with and without thewww
.This can be pasted in to the same configuration file and does not require that you separate them.
The
...
in the second server block is where you’d paste in the rest of your configuration.