Web——apache虚拟主机配置

配置apache支持WSGI

        1. 下载并安装mod_wsgi模块

        2. 配置apache的httpd.conf文件,配置加载mod_wsgi模块,增下如下配置

LoadModule wsgi_module          libexec/apache2/mod_wsgi.so

        3. 配置apache的虚拟主机,编辑httpd-vhosts.conf文件,增加如下配置:


    ServerAdmin [email protected]
    DocumentRoot "/Users/me/Project/PyDemo/Service"
    ServerName abc.local

    WSGIScriptAlias /Service /Users/me/Project/PyDemo/Service/handler.py

    LogLevel warn

    ErrorLog "/private/var/log/apache2/abc.local-error_log"
    CustomLog "/private/var/log/apache2/abc.local-access_log" common

        4. 配置上述虚拟主机目录的访问权限,编辑httpd.conf文件,增加如下配置:


    Options Indexes FollowSymLinks MultiViews

    AllowOverride None

    Order allow,deny

    Allow from all

配置相同主机不同端口的虚拟主机

        1. 配置apache需要监听的新端口,配置httpd.conf文件,增加如下配置:

Listen 8080

        2. 配置apache的虚拟主机,编辑httpd-vhosts.conf文件,增加如下配置:


    ServerAdmin [email protected]
    DocumentRoot "/Users/me/Project/HTML"
    ServerName abc.local

    LogLevel warn

    ErrorLog "/private/var/log/apache2/abc.local.8080-error_log"
    CustomLog "/private/var/log/apache2/abc.local.8080-access_log" common

        3. 配置上述虚拟主机目录的访问权限,编辑httpd.conf文件,增加如下配置:


    Options Indexes FollowSymLinks MultiViews

    AllowOverride None

    Order allow,deny

    Allow from all

你可能感兴趣的:(Web,apache,web,module)