安裝 Apache2
sudo apt-get install apache2
設定 Apache2 相關模組
sudo a2enmod headers
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
編輯 Apache2 設定檔 /etc/apache2/apache2.conf 加入
<VirtualHost 192.168.6.1:80>
#<VirtualHost *:80>
# ServerName example.com
# ServerAlias www.example.com
ServerAdmin webmaster@example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
RequestHeader unset Authorization
ProxyPass / http://192.168.0.1:8080/
ProxyPassReverse / http://192.168.0.1:8080/
<Location />
AuthType Basic
AuthName "You need to login"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
Order allow,deny
Allow from all
</Location>
</VirtualHost>
設定密碼檔 /etc/apache2/.htpasswd
sudo sh -c "echo -n 'user:' >> /etc/apache2/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> /etc/apache2/.htpasswd"
沒有留言:
張貼留言