Skip to content

Apache Configuration

Hunter Wu edited this page Jan 16, 2019 · 1 revision

docker

docker pull nimmis/apache-php7
docker run -d -p 8080:80 \
  -v /var/www/html:/var/www/html \
  nimmis/apache-php7

ProxyPass

Simeple pass

SSLProxyEngine on
ProxyPass /api_demo https://example.ngrok.io/api/demo
ProxyPassReverse /api_demo https://example.ngrok.io/api/demo

Smoothly migrate a website to a new IP address

<VirtualHost *:80>
  UseCanonicalName Off
  ServerAdmin support@wmh.github.io
  ServerName wmh.github.io
  DocumentRoot /var/www/html/wmh.github.io
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
  ProxyPass        / http://w2.wmh.github.io/
  ProxyPassReverse / http://w2.wmh.github.io/
  CustomLog /var/log/apache2/wmh.github.io-access.log combined
</VirtualHost>

Redirect

Redirect pages to a new domain name

RedirectMatch 301 ^/games(.*)$ http://wmh.github.io/games$1

Security

Remove server info

ServerTokens Prod
ServerSignature Off

Access control by host

Order deny,allow
Deny from all
Allow from dev.example.com
Clone this wiki locally