我有一个名为 service1.mydomain.local 的本地服务(apache + php) 一切都按照内部网络的设计进行。 我需要通过名称 service1.mydomain.com 从外部获得相同的服务
我还有 nginx 代理作为网络中的主要 http 服务器。 很多资源都可以通过它正常工作。
对于这种特殊情况,我的最佳配置不显示 CSS 和图片。 请帮忙修复CSS和图片。
Nginx
`server {
listen 80;
server_name service1.mydomain.com;
include snippets/letsencrypt.conf;
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl http2;
server_name service1.mydomain.com;
include snippets/letsencrypt.conf;
ssl_certificate /etc/letsencrypt/live/service1.mydomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/service1.mydomain.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/service1.mydomain.com/chain.pem;
access_log /var/log/nginx/service1.access.log;
error_log /var/log/nginx/service1.error.log info;
location / {
try_files $uri $uri/ /index.php?/$request_uri; #/index.php$args;
}
location ~ \.php$ {
proxy_pass http://service1.mydomain.local:80;
proxy_set_header Host service1.mydomain.local; #$host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ /\. {
deny all;
}
}`
阿帕奇
`<VirtualHost *:80>
ServerName service1.mydomain.local
DocumentRoot /usr/share/self-service-password/htdocs
DirectoryIndex index.php
AddDefaultCharset UTF-8
<Directory /usr/share/self-service-password/htdocs>
AllowOverride None
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3>
Order Deny,Allow
Allow from all
</IfVersion>
</Directory>
Alias /rest /usr/share/self-service-password/rest
<Directory /usr/share/self-service-password/rest>
AllowOverride None
<IfVersion >= 2.3>
Require all denied
</IfVersion>
<IfVersion < 2.3>
Order Deny,Allow
Deny from all
</IfVersion>
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/ssp_error.log
CustomLog /var/log/apache2/ssp_access.log combined
</VirtualHost>`