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

Posted November 17, 2021 45 views
UbuntuApachePythonPython Frameworks

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

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.

×
Submit an Answer
1 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:

  • 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