user746458
user746458

Reputation: 369

Domain url redirecting to localhost in apache2

I am facing a problem while mapping my domain name with my hosted django application running in 8000 port. I have seen a lot of posts regarding this issue but I think I am missing out something. I have tried many ways but all failed. My domain name is coachingfunda.com which is mapped with my ec2 public ip address in Godaddy. My 000-default.conf file is

    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

You can see that this url is working http://coachingfunda.com:8000/ which means my app is properly hosted but http://coachingfunda.com is redirecting to localhost:8000.

The problem seems stupid but I am stuck for about 2 days. Please help me here. My coachingfunda.conf is

   <VirtualHost *:8000>
    ServerAdmin [email protected]
    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>

Please help me. Any suggestion may work.

Upvotes: 0

Views: 4024

Answers (1)

TheGeorgeous
TheGeorgeous

Reputation: 4061

Take a backup of your default conf and copy the conf in your site into the default conf and reload and restart the server.

Upvotes: 2

Related Questions