我已经设置了一个代理 NGINX,可以访问 10.0.0.151 上的 Wordpress 服务器:
#
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
server {
server_name judith.com www.judith.com *.judith.com;
return 301 https://www.judith.com$request_uri;
}
server {
listen [::]:443 ssl;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/judith.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/judith.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
server_name judith.com www.judith.com *.judith.com;
location / {
proxy_pass http://10.0.0.151;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {
root http://10.0.0.151;
access_log off;
expires max;
}
client_max_body_size 2000M;
}
当要https://www.judith.com我可以访问该网页,获得认证(受信任的页面)并显示该页面,但不含所有静态内容(图像、CSS 等)。
如何使其正确显示所有静态内容(js、css、图像等)?
当然,我遗漏了一些简单的东西......感谢帮助。