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

We began to talk about the Apache (Apache) Service

tips:

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 Trojans are root privileges if webshell apache command rarely available)

 

Most sites are using the http protocol 80 port   https protocol port 443

 

web server to serve   send request 

 

http protocol is a connectionless transmission state after once disconnected, and no relationship at a transmission

 

Here we mainly talk about

Open the web page you want to show a string

apache service (changed to another suffix)

apache service (changed to another destination file)

 

 

 

 

apache service

 

Next we install apache service (practical exercise)

 

Look at the virtual machine, the default is no apache 's

 

 Let's download apache service

If this result occurs, then open a terminal, enter the command: kill -9 5344 just fine

 

 

 It

 

 Then we enter y, the installation is complete there will be a look

 

 

 

After installation default is dead, give him start it

Enter the command: systemctl Start httpd

This time you open the browser input in the virtual machine localhost will get such an interface

 

 

 

Be sure to restart the service is not restarted this page

 

 

 

Now we come to change the content of the page display

Next, enter the / var / www / html folder

Enter the command: cd / var / the WWW / HTML ( supposedly there is not here, then we have to create a file of a

 

 

 This time again I visited localhost Web page becomes a result of your input

 

 apache service (changed to another suffix)

 

Does anyone have a question, why do we just created to take when the folder name is index.html , if we call it anything he can do? Let's try

 

Enter the command: mv index.html 1.html (HTML folder operations )

 

 

 The answer is no

 

 But you localhost plus behind 1.html it can come out

 

 

Why is this so? Secret hidden in its configuration file

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

Inside is the default index.html suffix,

 

 

 If we change 1.html is not it?

When you're done, enter the command: systemctl restart httpd   restart service

This time 1.html came out

 

OK, Have a problem? We are not seen enter the ip input string can also visit the website of the country

In fact, Localhost   and   127.0.0.1 same effect, you can ping localhost seen

 

 

 

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 / the WWW   (First you want to home have this folder)

Create a new content in this folder is in the home pages

Enter the command: echo "in at The Home"> index.html  

Next, enter the configuration file, change

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

 

 

Change like this

 

 

After the restart the following services  enter the command: systemctl restart httpd

This time we visited website on the page should come out in the home

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 permission to change the file directory www of ( / Home / www 's)

 

Or change a subordinate group

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/longshisan/p/11766632.html