我有以下有效的 nginx 反向代理配置
server {
listen 192.168.100.7:443;
server_name mysite.internal;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_pass http://192.168.100.8;
proxy_http_version 1.1;
}
ssl on;
ssl_certificate /etc/nginx/certs/mycert.cer;
ssl_certificate_key /etc/nginx/certs/mycert.key;
ssl_session_timeout 5m;
}
我正在尝试将其转换为在 apache httpd 下运行,但我无法让它工作
答案1
您可以使用以下 Apache 配置进行反向代理。
<VirtualHost *:443>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1/
RequestHeader set X-Forwarded-Port "443"
RequestHeader set X-Forwarded-Proto "https"
DocumentRoot /var/www/html/
ServerName www.yourdomain.com
ErrorLog logs/yourdomain.com-error.log
CustomLog logs/yourdomain.com-access.log common
SSLEngine on
<Directory /var/www/html/>
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
SSLCertificateFile /path/to/your_domain_name.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
</VirtualHost>