首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >域url重定向到apache2中的本地主机

域url重定向到apache2中的本地主机
EN

Stack Overflow用户
提问于 2015-07-03 06:12:11
回答 1查看 3.7K关注 0票数 0

在将我的域名映射到运行在8000端口上的托管django应用程序时,我遇到了一个问题。我见过很多关于这个问题的帖子,但我想我遗漏了一些东西。我尝试过很多方法,但都失败了。我的域名是coachingfunda.com,它与我的ec2公共ip地址映射在Godaddy中。我的000-default.conf文件是

代码语言:javascript
复制
    LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
    LoadModule proxy_http_module        /usr/lib/apache2/modules/mod_proxy_http.so
  LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule deflate_module  /usr/lib/apache2/modules/mod_deflate.so

  <VirtualHost *:80>
  WSGIScriptAlias /wsgi/ /home/ubuntu/public_wsgi/
 #ProxyPreserveHost On
  #ProxyPass / http://nrollin.com:8080/nrollin
    # The ServerName directive sets the request scheme, hostname and         port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
     #ProxyPassMatch ^(.*)$ http://localhost:8000/$1
   #ProxyPass / http://coachingfunda.com/
  # ProxyPassReverse / http://127.0.0.1:8000/
ServerAlias www.coachingfunda.com
 ServerName coachingfunda.com
  #AliasMatch ^/(.*)  http://www.coachingfunda.com:8000/$1
Redirect permanent http://coachingfunda.com http://www.coachingfunda.com:8000/
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf

您可以看到这个url正在运行http://coachingfunda.com:8000/,这意味着我的应用程序是正确托管的,但是http://coachingfunda.com正在重定向到localhost:8000。

这个问题似乎很愚蠢,但我被困了大约两天。请帮帮我。我的coachingfunda.conf是

代码语言:javascript
复制
   <VirtualHost *:8000>
    ServerAdmin webmaster@mydomain.com
    ServerName coachingfunda.com
    ServerAlias www.coachingfunda.com
    WSGIScriptAlias /  /var/www/coachingfunda/index.wsgi

    Alias /static/ /home/ubuntu/coachingfunda/static/
    <Location "/static/">
  Options -Indexes
    </Location>
   <Directory "/home/ubuntu/coachingfunda/static/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
   </Directory>
    </VirtualHost>

请帮帮我。任何建议都可能有效。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-03 06:21:48

对默认的conf进行备份,并将站点中的conf复制到默认的conf中,然后重新加载并重新启动服务器。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31199706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档