如何在apache2服务器中配置域名?

时间:2018-02-11 17:20:29

标签: python django apache django-models

我已经使用Apache2部署了两个Django站点,可以通过以下链接访问

http://93.188.167.63/cholera/
http://93.188.167.63:8080/pep_learn/

这是我的“000-default.conf”文件。

 <VirtualHost *:80>
        # 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

        Alias /static /home/myproject/DATAPLO/static
        <Directory /home/myproject/DATAPLO/static>
            Require all granted
        </Directory>


        <Directory /home/myproject/trytable>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>

        WSGIDaemonProcess myproject python-path=/home/myproject:/home/myproject/myprojectenv/lib/python2.7/site-packages
        WSGIProcessGroup myproject
        WSGIScriptAlias / /home/myproject/trytable/wsgi.py

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # 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
    </VirtualHost>

    Listen 8080

    <VirtualHost *:8080>


        Alias /static /home/pep_web/protocol/static
        <Directory /home/pep_web/protocol/static>
            Require all granted
        </Directory>


        <Directory /home/pep_web/pep_learn>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>

        WSGIDaemonProcess pep_web python-path=/home/pep_web:/usr/lib/python2.7/dist-packages
        WSGIProcessGroup pep_web
        WSGIScriptAlias /pep_learn  /home/pep_web/pep_learn/wsgi.py

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ServerName mypepapp.com


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


    </VirtualHost>

最近,我通过“godady”购买了第二个链接的域名 我尝试使用第二个链接配置域名“www.mydomain.com”,但它不起作用可以任何人建议我一个合适而简单的方式来访问我的应用程序,如下所示:

 www.mydomain.com/pep_learn

目前可以访问:

93.188.167.63:8080/pep_learn

谢谢

0 个答案:

没有答案