1、安裝整合php
yum install httpd
yum install php
systemctl restart httpd
2、開啟url重寫功能
修改 /etc/httpd/conf/httpd.conf:
A 開啟重寫模組:
LoadModule rewrite_module modules/mod_rewrite.so
Include conf.modules.d/*.conf
B 修改引數 AllowOverride All
C 網站根目錄新增.htaccess重寫規則檔案
RewriteEngine On
RewriteRule ^pda/api/([a-zA-Z0-9_-]+)$ pda/php/$1.php
3、生成證書
安裝certbot工具:yum install certbot
保留機器的80埠:certbot certonly --standalone -d mashangcha.unionware.com.cn
4、安裝apache SSL支援模組
yum install mod_ssl
5、配置apache SSL證書
載入ssl模組:LoadModule ssl_module modules/mod_ssl.so
修改conf.modules.d/ssl.conf,增加以下配置:
<VirtualHost *:443> DocumentRoot "/var/www/html" ServerName xxxxx.com:443 #api字首的代理到8000 ProxyPass /web http://yyyyy.com/web ProxyPassReverse /web http://yyyyy.com/web ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log LogLevel warn SSLEngine on SSLCertificateFile /etc/letsencrypt/live/xxxxxx.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/xxxxxx.com/privkey.pem <Directory "/var/www/html"> SSLOptions +StdEnvVars Options +Indexes +FollowSymLinks +ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>