AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-384963

buddha_buddha's questions

Martin Hope
buddha_buddha
Asked: 2016-11-10 10:53:28 +0800 CST

显示 / 没有 www 的索引,使用 www 正常工作

  • 0

我正在使用 Python、Flask 和 Apache,但我被困住了。当我尝试使用 www 访问我的网站时,它工作正常。但是,当我删除 www 时,该网站显示“/ 的索引”,接下来是一个空的文件列表。我已经阅读了所有可能的解决方案,在我的情况下没有任何效果。我正在使用 WSGI,这意味着 DocumentRoot 无关紧要,因为我使用的是 WSGIScriptAlias 变量。我按照指示使用 ServerAlias - 没有帮助。我在我的 dns 选项中设置了 2 条单独的 A 记录,它们都指向同一个 ip。当我用 www 和不带 www ping 网站时,显示相同的 IP 地址

<VirtualHost *:80>
    ServerName mysite.com
    ServerAlias www.mysite.com
    WSGIScriptAlias / /var/www/mysite/mysite.wsgi
    <Directory /var/www/mysite/mysite/>
        Order allow,deny
        Allow from all
    </Directory>
    Alias /static /var/www/mysite/mysite/app/static
    <Directory /var/www/mysite/mysite/app/static/>
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
... 

</VirtualHost>

有任何想法吗?

这是“apachectl -S”命令的输出:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server mysite.com (/etc/apache2/sites-enabled      /000-default.conf:1) 
     port 80 namevhost mysite.com (/etc/apache2/sites-enabled    /000-default.conf:1)
     port 80 namevhost mysite.com (/etc/apache2/sites-enabled    /mysite.conf:1)
             alias www.mysite.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
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
domain-name-system python apache-2.4 flask wsgi
  • 1 个回答
  • 262 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve