httpd server set up

Buy a server

Happy, along with the site environment for doing exercises to build

I use the Apache + php + mysql

 

1. Install apache

This in two ways:

1)  yum -y install apache

2) to apache official website to download the tar package to the server, extract, ./configure, make & make install

Profile position of a first method for mounting in / ect / httpd / conf,

The second is the custom directory

 

2. Install php

As a php script parser, it is suitable for lightweight development

Installation and almost apache above, it is proposed

yum -y install php

 

3. Configure httpd service

vim editor /ect/httpd/conf/httpd.conf:

ServerRoot is the location of httpd configuration file; 

DocumentRoot is the default storage path of our website, when url to access the default path is in / var / www / html under

 

Html write a simple test to see if the installation was successful:

New file index.html (the default access file), reads as follows:

<html>
    <body>
    <h1>
        What's your problem?</h1>
    </body>
</html>

On var / www / html / directory

 

Then open about service httpd:

* Pit 1 

Note that the port should be open about the cloud server:

 

Access (port 80 by default, so do not take port access)

This, as long as we've built a good php projects uploaded to / var / www / html directory, subdirectory and then use to access

For example, there is a test project, and then uploaded to the directory server, url access to: www.meta.com/tes

 

 

4. Modify the httpd port

Drone practice as a server, port, of course, not so exposed, so people will thus be an opportunity to attack the server, so try to modify the default port for httpd

** hole 2

Note that changing the port can not conflict with existing port ..

Open the configuration file /etc/httpd/conf/httpd.conf:

Modify the listening port is 1234 80:

 

And modify the 80-port server cloud:

Service httpd restart:

然后带端口访问:

完成!

 

5. 总结

我在修改端口为6668之后, 不能正常访问, 

但是用telnet和netstat检测端口是正常的:

但是url访问就是不正常...奇怪..反正换个端口就行了,,留个坑

 

 

 

发布了25 篇原创文章 · 获赞 0 · 访问量 171

Guess you like

Origin blog.csdn.net/angry_program/article/details/103936589