Configure apache + tomcat in ubuntu

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.