APACHE 配置虚拟主机和HTTPS

 

prepare the running env of os

make sure you are using redhat or centen os 7.5
cat /etc/redhat-release
yum install git
yum install openssl

prepare the running env apache

yum install httpd
yum install mod_wsgi
yum install mod_ssl
config cert for apache refer to https://help.aliyun.com/knowledge_detail/95493.html?spm=5176.2020520154.cas.40.6af0yuzByuzByE

how to run it at appche httpd2.4.6 of Redhat7.5

git the code at /app/ and it will at

/app/yourproject/

add the config of follow to /etc/httpd/conf/httpd.conf

support python web wsgi

<VirtualHost *:80>
        DocumentRoot "/appvol/SigninWork"
        ServerName checkin.robin.org.cn
        #ServerAlias checkin.robin.org.cn
        WSGIScriptAlias / /appvol/SigninWork/code.py/
        Alias /static  /appvol/SigninWork/static/
        AddType text/html .py

       #对于80端口开启RUL重定向
       RewriteEngine on
       RewriteCond %{HTTPS} !=on
       RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]

       <Directory "/appvol/SigninWork">
                 Options FollowSymLinks
                 AllowOverride All
                 Require all granted
        </Directory>
</VirtualHost>
<VirtualHost *:443>
        DocumentRoot "/appvol/SigninWork"
        ServerName checkin.robin.org.cn
        #ServerAlias www.robin.org.cn
        WSGIScriptAlias / /appvol/SigninWork/code.py/
        Alias /static  /appvol/SigninWork/static/
        AddType text/html .py
        <Directory "/appvol/SigninWork">
                 Options FollowSymLinks
                 AllowOverride All
                 Require all granted
        </Directory>
</VirtualHost>

support php

<VirtualHost *:80>
        DocumentRoot "/appvol/wordpress_blog"
        ServerName robin.org.cn
        ServerAlias www.robin.org.cn blog.robin.org.cn
        AddType text/html .php
       
        #对于80端口开启RUL重定向
        RewriteEngine on
        RewriteCond   %{HTTPS} !=on
        RewriteRule   ^(.*)  https://%{SERVER_NAME}$1 [L,R]

        <Directory "/appvol/wordpress_blog">
                 Options FollowSymLinks
                 AllowOverride All
                 Require all granted
        </Directory>
</VirtualHost>

<VirtualHost *:443>
        DocumentRoot "/appvol/wordpress_blog"
        ServerName robin.org.cn
        ServerAlias www.robin.org.cn blog.robin.org.cn
        AddType text/html .php
        <Directory "/appvol/wordpress_blog">
                 Options FollowSymLinks
                 AllowOverride All
                 Require all granted
        </Directory>
</VirtualHost>

转载于:https://www.cnblogs.com/lihuanhuan/p/10612107.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值