networking - Setting Up Reverse Proxy on Ubuntu - Ask Ubuntu


i have 2 ubuntu 16.04 (lts) instances on amazon ec2. on same virtual private cloud. have lamp installed on both , able call web page on 1 web page on other. centos, edit /etc/httpd/conf/httpd.conf , append following line

proxypass /app1/ http://10.0.1.27/ 

then, after restart apache

sudo service httpd restart 

i can enter following code, on web page of current server

<li><a href="/app1/whatever.php">whatever</a></li> 

and web page whatever.php, on server private ip 10.0.1.27, displayed on browser when click whatever button.

however, ubuntu not have /etc/httpd/conf/httpd.conf file.

i tried setting reverse proxy outlined here , entered following in /etc/apache2/sites-available/proxy-host file.

<virtualhost *:80>   serveradmin webmaster@localhost   documentroot /var/www/html/   errorlog ${apache_log_dir}/error.log       customlog ${apache_log_dir}/access.log combined   proxypreservehost on   # servers proxy connection, or   # list of application servers usage   proxypass /app/ http://10.0.1.27:8080/   proxypass / http://10.0.1.110:8080/   # proxypassreverse / http://server-ip-address:8080/   servername localhost </virtualhost> 

i enter

sudo a2ensite proxy-ssl-host.conf 

and get

 error: site proxy-ssl-host not exist! 

then enter

sudo a2ensite /etc/apache2/sites-available/proxy-host 

and get

error: site /etc/apache2/sites-available/proxy-host not exist! 

i enter

 sudo /etc/init.d/apache2 restart 

however, when click on whatever button, 404 error

not found  requested url /app/dracula.php not found on server.  apache/2.4.18 (ubuntu) server @ 52.207.143.84 port 80 

you might want double check name of config file , file name use in a2ensite command identical. example, if config in /etc/apache2/sites-available/my_vhost.conf, command a2ensite my-vhost.conf won't work.

it's been practice long time give vhost configs extension .conf. apache 2.2 , earlier, optional, since apache 2.4 (which shipped ubuntu 16.04) .conf extension mandatory.

after enabled (or disabled, matter) vhost, need reload apache.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User