Configure Apache server on Ubuntu
1. Installing Apache
sudo apt-get install apache2
After the Apache installation is complete, the default Web site root directory is/var/www/html, which has a index.html file (entered in the browser: 127.0.0.1 or localhost can open the page)
2. Configuration files
Apache has two configuration files: apache2.conf (/etc/apache2/apache2.conf); and 000-default.conf (/etc/apache2/sites-available)
How to modify the Web site root directory: sudo vi/etc/apache2/apache2.conf, modify <Directory/var/www/>/var/www/in the new root directory (here I did not change)
sudo vi/etc/apache2/sites-available/000-default.conf, modify the location of the documentroot/var/www/html for the new root directory; Here I change it to/var/www/
3. Restart Apache:sudo/etc/init.d/apache2 restart
4. Test the success of changing the site root directory: Enter localhost or 127.0.0.1 in the browser
5. The content that the copy needs to access in the/var/www/directory, browser localhost can react
Configuring the Tomcat server on Ubuntu
1. Download tomcat:http://tomcat.apache.org/download-80.cgi
Download the tar.gz file, extract the command as: TAR-ZXVF tomcat.tar.gz
2. Configure Tomcat
1) Copy the extracted files to, opt directory: sudo cp-r tomcat8/opt
2) Enter CD/OPT/TOMCAT8, open the startup script: sudo vi startup.sh, add JDK and JRE as follows:
。。。
3) Start Tomcat:sudo. bin/startup.sh, where the corresponding JRE, Java information is displayed
4) Verify that the Tomcat installation was successful and entered in the browser: localhost:8080
5) Close Tomcat:sudo. bin/shutdown.sh
Configure Apache server and Tomcat server on Ubuntu