LoginSignup
10
12

More than 5 years have passed since last update.

Apacheでリバースプロキシ

Last updated at Posted at 2016-09-01

環境

$ 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 へのアクセスとして処理される。

10
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
12