Question

I have two domain i want to point one to html page & second to flask app.in my case both domain is pointing toward html page

My two domain

  1. aditya…ts.xyz
  2. adityad…ce.com

i want second domain to point at In My /var/www/html

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Aditya</title>
    <style>
        .main {
            display: table;
        }
        strong {
            color: black;
        }
        h1 {
            color: white;
            font-family: Arial, Helvetica, sans-serif;
        }
        body {
            background-color: tomato;
        }
        a {
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="main">
        <div class="heading">
            <h1>Hello!, It's Aditya <strong><a href="https://t.me/lazycoderalways">Contact Me</a></strong></h1>
        </div>
    </div>
</body>
</html>

I want my first domain to point at in my flask app /var/www/telegram_bot mybot.wsgi

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/telegram_bot/")

from telegram_bot import app as application
application.secret_key = 'Add your secret key'

my telegram_bot.conf

<VirtualHost *:80>
		ServerName aditya...ts.xyz
		ServerAlias www.aditya...ts.xyz
		ServerAdmin admin@mywebsite.com
		WSGIScriptAlias / /var/www/telegram_bot/mybot.wsgi
		<Directory /var/www/telegram_bot/telegram_bot/>
			Order allow,deny
			Allow from all
		</Directory>
		Alias /static /var/www/telegram_bot/telegram_bot/static
		<Directory /var/www/telegram_bot/telegram_bot/static/>
			Order allow,deny
			Allow from all
		</Directory>
		ErrorLog ${APACHE_LOG_DIR}/error.log
		LogLevel warn
		CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I have already enable conf


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
November 18, 2021
Accepted Answer

Hello,

Is it the Flask application that is not loading correctly? If so, do you have the wsgi Apache module enabled?

If not, you can install it by running the following:

sudo apt-get install libapache2-mod-wsgi python-dev

To enable mod_wsgi, run the following command:

sudo a2enmod wsgi 

I could suggest checking your Apache error log to see if there are any errors that could point you in the right direction:

  1. sudo tail -100 /var/log/apache2/error.log

Also could you share the Apache Vhost for the domain that should point to /var/www/html.

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.