怎么样,当我尝试访问http(端口:80)时,我尝试在Ubuntu和Nginx服务器上安装安全证书,但是没有问题。详细信息是当我访问页面时尝试重定向到https(端口:443)时指示403 Forbidden。
我遵循的一些建议是关于错误的索引文件的。添加我在项目中使用的扩展名为hbs。有什么指南可以建议我遵循吗? 这是我在Nginx中的文件。
server {
listen 80;
root /var/www/myapp;
index index.html index.htm index.nginx-debian.html;
#server_name example.com www.example.com;
location / {
#try_files $uri $uri/ =404;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://1.1.1.1:3000/; //example
return 301 https://example.com$request_uri;
}
}
server {
listen 443;
root /var/www/myapp;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
ssl on;
ssl_certificate /etc/ssl/cert/example.crt;
ssl_certificate_key /etc/ssl/cert/example.key;
ssl_trusted_certificate /etc/ssl/cert/example.crt;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
它在端口80(http)上运行良好,看到其他与https有关的问题,我认为该文件夹的权限被授予了权限,但这是服务器上的灾难,我最终关闭了端口22。 有什么建议吗?