Please, kindly need help, after deployed flask application on ubuntu 14 into this path var/www/FlaskApp, Accessing my IP, it display correctly, So, i decided to point my domain to digital ocean which display “Apache2 Ubuntu Default Page”, please how do i remove this default page to display the content on var/www/FlaskApp

Here is my folder structure var/www
———————FlaskApp
————————— templates
————————— static
————————— app.py
———————html
———————scrapy.cfg

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
7 answers

After you have installed the Apache2, you need to configure virtual hosts.
The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com,company2.example.com and anotherexample.com) on a single machine. Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.

All the apache VHOSTs are stored inside /etc/apache2/sites-available/vhosts.conf . You can create your own VHOST here, so apache2 will handle a certain domain or IP. For this sake you would need to use the following command:

sudo nano /etc/apache2/sites-available/yourdomain.conf

Inside you would need to add this:

<VirtualHost *:80>
    ServerAdmin admin@domain.com
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/domain.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/domain.com_error.log
    CustomLog ${APACHE_LOG_DIR}/domain.com_access.log combined
</VirtualHost>

You would need to edit this to your own setup, so change domain.com to your own domain.
After creathin this VHOST save it and exit the nano. You will now need to activate the VHOST.
Apache includes a certain directory inside its system wich will enable a VHOST:

sites-enabled: like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sites-available directory. Similarly when a configuration file in sites-available is symlinked, the site configured by it will be active once Apache2 is restarted.
Use this command:

sudo a2ensite yourdomain.conf

Now restart apache and it should all work:

sudo service apache2 restart
  • Thanks @CrypticDesigns appreciate your response, i’ve done exactly but the domain still showing “Apache2 Ubuntu Default Page”, i’m running Flask Application (Python) on this directory var/www/FlaskApp.

    Any other approach or what’s missing? Thanks

1st you need to disable default configuration, RUN>>

a2dissite 000-default.conf

and then restart apache2 >>>

service apache2 restart

Hope this will help to solve the issue :)

hi, i have tried all those things mention above but still m not able to remove that page , could u plz help me out ?

I’m having the same issue :/

how if i want to open using IP Address?

I’m having the exact same issue. I can’t get rid of the apache default page. I’m using apache as a reverse proxy only, so no content is served by apache itself. The reverse proxy works for any URL requested except for the main /, in that case I always get the default page. Already tried all mentioned things here.

Hello,

I was able to solve this issue by below steps:

myproject here is depend on what you previously setup.

  1. Edit:
    $ sudo vim /etc/nginx/sites-available/myproject

  2. Find:
    server {
    listen 80;
    servername serverdomainorIP;

  3. Replace serverdomainor_IP with your domain name.

  4. Restart:
    $ sudo service apache2 restart

Submit an Answer