On a virtual machine on Apache (Apache) (1) open the Apache service as well as introduction of basic services

Apache allows a server to put a lot of sites, you can visit the site at the same time make the site safer (if the Trojan is a command with root privileges if webshell apache rarely available)

Apache 80-port (http)     

https 443 port (https)

apache 1 ~ 1999 belongs to the system user Apache: Specifies the listener's ip address, port number, the default is 80

Install Apache (file entry but not the apache httpd)

 

Virtual web hosting features

Apache's virtual hosts  (Virtual Host)  can make a server-based technology IP, host name or port number, a Web site to provide more services .

 

apache service

 Next we install apache service

Look at the virtual machine, the default is not the apache

 

 

 Download apache service enter: yum install apache

 

 

 carry out

 

 

 

After installation default is not activated, it starts to give him

Enter the command: systemctl start httpd

This time you open the browser and enter localhost or (ip of this virtual machine or 127.0.0.1) in a virtual machine will get such an interface

 

 

 

Now we come to change the content of the page display

Next, enter the / var / www / html folder

Enter the command: cd / var / www / html 

 

Create a html file and write, displayed in the browser

 

 

 This time again when accessing localhost web page becomes a result of your input

 

 

 

 

 apache service (changed to another suffix)

 

 When the folder you just created to take the name index.html, if we call it anything he can do? Let's try

 

Enter the command: mv index.html 1.html (html folder operations) mv command in the same directory as the file name modified

 

 

 

The content displayed on your browser no matter

 

 

 

 

 

But you can add 1.html it out in the back localhost

 

 

 

 

Why is this so? Secret hidden in its configuration file

Enter the command: vi /etc/httpd/conf/httpd.conf  

The default is index.html inside suffix,

 

 We will change it to 1.html

 

 When you're done, enter the command: systemctl restart httpd restart the service, go to browser search localhost

 

 

apache service (changed to another destination file)

The default home directory is / var / www / html Here we can change its directory

For example, change the / home / www 

 

 Under this new content to a folder / home / www pages

 

 

Next, enter the configuration file, change

Enter the command: vi /etc/httpd/conf/httpd.conf will change the directory where your web page here

 

 

Change

 

 

 Save and exit, and then enter the command to restart the following services: systemctl restart httpd

 

 

The results did not change after completing the restart

 

If you do not come out, the emergence of the following circumstances, it is enough authority

 

 

Let's change it to change the directory permissions of the file www (/ home / www's)

 

Or change a subordinate group

 

Guess you like

Origin www.cnblogs.com/escwq/p/11782446.html