Welcome to install the Apache server and the totoapache Server
You can use the Source Code compiling mode or the apt command or the apt graphical software package for installation by running.
Compilation mode:
1. Download and install dependency packages, such as apr, apr-util, and apache.
2. Extract the tar package
3./configure configuration, specifying the installation location
4. make Compilation
5. install sudo make install
For more information, see Baidu. I have installed it in apt command mode. On the terminal, enter sudo apt-get install apache2 and press enter to enter the password to install it. I have installed it here.
You can specify the installation directory in the compilation mode. For example, if you install the directory in/usr/local/apache2, apt-get uses the default installation path.
The apache2 service is enabled after the default installation is complete. The service port number is 80 by default. For the following test, the/usr/www/html/index.html page is specified by default.
You can add your own html to the page for testing, such as adding your own html.
Commands for starting, stopping, and restarting
The control script of the Apache server is apache2ctl. The parameter passing through this script controls the startup and shutdown of the Apache server (requires the root permission). The three commonly used parameters are start, stop, and restart,
Run this command to start: sudo apache2ctl start
If the system prompts that the apache2ctl command cannot be found, it is likely that the directory where the apache2ctl script is located is not added to the search path. Run this command using the absolute path. For example, install Apache in the/usr/local/apache2 directory and run the following command to start the Apache server:
Sudo/usr/local/apache2/bin/apache2ctl start
If you are not sure where Apache is installed, you can use the whereis command to find it.
// Apache // Task: Start Apache 2 Server/Start apache service #/etc/init. d/apache2 start // or $ sudo/etc/init. d/apache2 start // Task: Restart Apache 2 Server/Restart apache service #/etc/init. d/apache2 restart // or $ sudo/etc/init. d/apache2 restart // Task: Stop Apache 2 Server/Stop apache service #/etc/init. d/apache2 stop // or $ sudo/etc/init. d/apache2 stop // Mysql/etc/init. d/mysql start/etc/init. d/mysql stop/etc/init. d/mysql restart
The above is a manual start, which allows you to set Apache to automatically start during system boot. Different Liunx Release versions may sometimes be different. Here is how to set them.
Create a link in the rc directory and point to/etc/init. d/httpd file, run the command: sudo ln-s/etc/init. d/httpd/etc/rc.5/S91apache2, so that the Apache server will be started every time you enter runtime Level 5