環境
$ uname -a
Linux www5198uf 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ sudo apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-07-14T12:32:26
設定
$ sudo aptitude install apache2
/etc/apache2/sites-available
に *.conf
という名前で設定を書く。
$ cat /etc/apache2/sites-available/hoge.conf
<VirtualHost *:80>
ProxyPreserveHost On
ServerName hoge.net
ProxyPass / http://127.0.0.1:10080/
ProxyPassReverse / http://127.0.0.1:10080/
ErrorLog ${APACHE_LOG_DIR}/hoge_error.log
</VirtualHost>
$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2ensite hoge.conf
$ sudo service apache2 restart
これで、http://hoge.net
というホストへのアクセスは http://127.0.0.1:10080
へのアクセスとして処理される。