gpt4 book ai didi

node.js - 清除 SSL 后响应 404 的 nginx 上的 URL

转载 作者:太空宇宙 更新时间:2023-11-03 13:25:10 27 4
gpt4 key购买 nike

我将 SSL 添加到我的站点,并且在本地托管时能够正常访问其他页面,但在在线托管时它就不再工作了。

例如,我可以访问http://localhost:3000http://localhost:3000/test .我也可以访问 https://example.com ,但我无法访问 https://example.com/testhttps://example.com/other .

我在后端使用 node 和 express 以及 nginx。我认为这与我的虚拟主机有关,但这就是我目前的所有情况。

server {
listen 443 default_server;
ssl on;
ssl_certificate /home/anon/cert_chain.crt;
ssl_certificate_key /home/anon/example.com.key;

root /srv/www/example.com/public_html;
index index.html;

# Make site accessible from http://localhost/
server_name example.com;

location / {
proxy_pass http://localhost:3000;
}
}

server {
listen 80;

return 301 https://$host$request_uri;
}

访问日志:

153.6.67.184 - - [23/Jan/2016:06:48:39 -0500] "GET /stylesheets/style.css HTTP/1.1" 404 366 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:48:40 -0500] "GET /service-worker.js HTTP/1.1" 304 0 "https://example.com/service-worker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:55 -0500] "GET /api HTTP/1.1" 404 366 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:55 -0500] "GET /stylesheets/style.css HTTP/1.1" 404 366 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:55 -0500] "GET /favicon.ico HTTP/1.1" 200 4286 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:56 -0500] "GET /api HTTP/1.1" 404 366 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:56 -0500] "GET /stylesheets/style.css HTTP/1.1" 404 366 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:56 -0500] "GET /favicon.ico HTTP/1.1" 200 4286 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:56 -0500] "GET /api HTTP/1.1" 404 366 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:56 -0500] "GET /stylesheets/style.css HTTP/1.1" 404 366 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
153.6.67.184 - - [23/Jan/2016:06:49:56 -0500] "GET /favicon.ico HTTP/1.1" 200 4286 "https://example.com/api" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"

错误日志:

2016/01/22 20:00:09 [notice] 8121#0: signal process started
2016/01/22 20:09:22 [notice] 8442#0: signal process started
2016/01/22 20:09:57 [notice] 8468#0: signal process started
2016/01/22 20:11:47 [notice] 8544#0: signal process started

最佳答案

好吧,事实证明我没有在服务器上运行 MongoDB,这就是它没有加载 API 的全部原因。 nginx 一直运行良好。

关于node.js - 清除 SSL 后响应 404 的 nginx 上的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34958541/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com