我在我的网站上添加了SSL,并且能够在本地托管时访问其他网页,但是当它在线托管时它不再有效。
例如,我可以访问http://localhost:3000和http://localhost:3000/test。我也可以访问https://example.com,但我无法访问https://example.com/test或https://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
答案 0 :(得分:1)
嗯,事实证明我没有在服务器上运行MongoDB,这就是它没有加载API的全部原因。 nginx一直很好。