docker安装php-apache
一、运行镜像
- docker run -d -p 80:80 --privileged=true --name httpd --link mysql5.7 -v C:\docker\www:/var/www/html -v C:\docker\apache\conf:/usr/local/apache2/conf -v C:\docker\php7.2\conf:/usr/local/etc/php/conf.d --restart=always php:7.2-apache
二、配置站点
开启rewrite功能 a2enmod rewrite
- <VirtualHost *:80>
- ServerName localhost
- DocumentRoot /var/www/html
- <Directory /var/www/html>
- Options Indexes FollowSymLinks
- AllowOverride All
- Require all granted
- </Directory>
- RewriteEngine on
- RewriteCond %{REQUEST_METHOD} ^TRACE
- RewriteRule .* - [F]
- RewriteRule !(^/static|\.(gif|swf|exe|png|jpg|js|css)$) /index.php [L]
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- </VirtualHost>