【问题标题】:Apache2 Ubuntu default page after reverse proxy on example.com instead of Odoo website在 example.com 而不是 Odoo 网站上反向代理后的 Apache2 Ubuntu 默认页面
【发布时间】:2022-01-14 15:29:28
【问题描述】:

你好吗?

当我为网站配置反向代理时,Odoo 适用于 www.example.com,但不适用于 example.com,然后它显示 apache2ubuntu 默认页面。

.conf 文件:

<VirtualHost *:80>
ServerName example   
ServerAlias www.example.com   
ServerAdmin root@example.com   
ErrorLog /var/log/apache2/error.log   
CustomLog /var/log/apache2/access.log combined   

ProxyRequests Off   
<Proxy *>   
Order deny,allow   
Allow from all    
</Proxy>    

ProxyPass / http://server ip:8069/    
ProxyPassReverse / http://server ip:8069/    

<Location />    
Order allow,deny    
Allow from all    
</Location>    

</VirtualHost>    

.conf 文件的错误配置是什么?

感谢您的帮助, 埃米利奥

【问题讨论】:

    标签: proxy dns apache2 odoo reverse


    【解决方案1】:

    首先,确认您的“服务器名称”是 example.com,而不仅仅是示例。 您还可以使用以下命令检查活动的虚拟主机:

    apache2ctl -S
    

    【讨论】:

    • Rose,我会在下面回答你,因为答案的长度不允许粘贴活动的虚拟主机。谢谢,埃米利奥
    【解决方案2】:

    感谢罗斯的快速回答,

    所以我会在 Apache2Proxy.conf 文件中使用 example.com 更新服务器名称: 之后,我重新启动了 apache:

    sudo systemctl restart apache2.service
    

    然后,执行命令:

    apache2ctl -S
    
    VirtualHost configuration:
    *:80                   is a NameVirtualHost
             default server example.com (/etc/apache2/sites-enabled/000-default.conf:1)
             port 80 namevhost example.com (/etc/apache2/sites-enabled/000-default.conf:1)
             port 80 namevhost example.com (/etc/apache2/sites-enabled/Apache2Proxy.conf:1)
                     alias www.example.com
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    Mutex watchdog-callback: using_defaults
    Mutex proxy-balancer-shm: using_defaults
    Mutex ssl-stapling-refresh: using_defaults
    Mutex ssl-stapling: using_defaults
    Mutex proxy: using_defaults
    Mutex ssl-cache: using_defaults
    Mutex default: dir="/var/run/apache2/" mechanism=default
    PidFile: "/var/run/apache2/apache2.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    User: name="www-data" id=33
    Group: name="www-data" id=33
    

    但我对 apache 的了解并不能让我知道此配置是否有问题。

    最好的问候和感谢, 埃米利奥

    【讨论】:

    • 根据 'apache2ctl -S' 命令的输出,您还可以使用 example.com 作为 ServerName 的 000-default.conf 配置。尝试使用命令“a2dissite 000-default”禁用默认配置,然后重新启动 Apache 服务。
    猜你喜欢
    • 2018-06-17
    • 1970-01-01
    • 1970-01-01
    • 2020-06-28
    • 2013-10-28
    • 1970-01-01
    • 2021-04-06
    • 1970-01-01
    • 2022-06-13
    相关资源
    最近更新 更多