This is an old revision of the document!
# Apache2配置
## Apache2基本配置
## Apache2 PHP配置
首先安装apache的php模块,然后启用
* 安装php模块,Ubuntu下使用`apt install libapache2-mod-php`安装 * 启用php模块,`a2enmod php`或`a2enmod php7.0`
## Apache2端口转发
在配置文件(Ubuntu下配置文件位于/etc/apache2/sites-available/000-default.conf)中加入以下内容:
```xml <VirtualHost *:80> ProxyPreserveHost On ProxyRequests Off ServerName www.example.com ServerAlias example.com ProxyPass / http://localhost:8080/example/ ProxyPassReverse / http://localhost:8080/example/ </VirtualHost> ```
安装启用proxy和http\_proxy两个模块(例如Ubuntu下执行`sudo a2enmod proxy && sudo a2enmod proxy_http && sudo service apache2 restart`)
## Apache配置免费ssl证书 [How To Secure Apache with Let's Encrypt on Ubuntu 16.04](https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04)