1. Configure VirtualHost
Ubuntu has the largest number of individual users in various Linux releases. Many of them are used in the local and virtual machines. However, the VirtualHost setting methods for Ubuntu and Redhat are different.
1. open the/etc/apache2/sites-available/directory and find the default and default-ssl files. default is the configuration file of the http VM service, default-ssl is used to configure the https service. you can copy a default file. and modify the configuration file name. The file name must be consistent with the domain name (for example, demo.aliluna.com)
2. Open the new configuration file and modify DocumentRoot, ServerName, and the corresponding configuration directory. The example is as follows:
#
# DocumentRoot is the root directory for storing website files
# ServerName is the website domain name, which must be consistent with the domain name pointed to by DNS
#
<VirtualHost *: 80>
ServerAdmin zhao.wuz@alibaba-inc.com
DocumentRoot/var/www/httpdocs/demo_aliluna_com
ServerName demo.aliluna.com
ErrorLog $ {APACHE_LOG_DIR}/demo.aliluna.com-error. log
CustomLog $ {APACHE_LOG_DIR}/demo.aliluna.com-access. log combined
</VirtualHost>
3. Activate the virtual host configuration through a2ensite
Sudo a2ensite demo.aliluna.com
4. Open the/etc/apache2/sites-enabled/directory, and you will find that all activated virtual hosts can be logged out through a2dissite.
Sudo a2dissite demo.aliluna.com
5. Restart the Apache service and activate the VM.
Sudo/etc/init. d/apache2 restart
II. Configure proxy_http
1. Install httpd
Sudo apt-get install apache2
2. Install mod_proxy
Cd/etc/apache2/mods-available
Sudo a2enmod proxy_http
3. Configure mod_proxy
Modify/etc/apache2/sites-available/www.zhangyutai.com
Join
ProxyPass/http: // localhost: 8781/
ProxyPassReverse/http: // localhost: 8781/
Author san_yun