![](/img/trans.png)
[英]apache error - 403 forbidden on virtual host via nginx reverse proxy
[英]Configure Apache reverse proxy and regular virtual host
我读过像我这样的几篇文章,但似乎都没有。
我在CentOS 7上有一个正常的apache配置,其中有一个正常工作的网站,包括HTTP和HTTPS(certbot)。
我还有一个Web端口为`:3000的服务,我想这样运行:
http(s)://example.com (常规网站内容)
http(s)://example.com/new_site (端口3000上的服务)
我已将网站设置为虚拟主机,并在/var/www/example.com/docroot
有一个自定义的webroot
这是我当前的工作配置。 我意识到本地主机之间的连接不需要是HTTPS,只需输入请求即可:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
ProxyPass /my_site http://localhost:3000
ProxyPassReverse /my_site http://localhost:3000
ErrorLog /var/log/httpd/my_vhost_log
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
</IfModule>
我还通过启用httpd_can_network_connect SELinux boolean
清除了权限问题。
更新:
现在的问题是,上面的配置会覆盖我的常规网站内容,因此,如果转到https://example.com ,它将仅显示Apache欢迎页面,而不是/var/www/example.com/docroot
。
主要配置:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/docroot
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
</IfModule>
如果有人碰到这个,
解决方法只是将代理行添加到您的主域配置中。 您只需要一个配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.