centos 6.5 build simple file server using Apache

1: set up a web server

安装   yum -y install httpd   

启动httpd    service httpd restart
 
Direct input ip test page, the firewall needs to release port 80.

 

 

2: Cancel the Apache Welcome page

Into the configuration file vim /etc/httpd/conf.d/welcome.conf commented framed documents

 

 

 service httpd restart Then test page, no welcome screen

 3 rpm using a lamp built environment

 yum install httpd mysql-server php php-mysql

The installation is complete on the page test results are as follows,

 

 

Then you can put files into the default directory for testing,

cd / var / www / html / download a file to the var / www / html / directory

 

 And then restart it, enter the ip test directly on the page, the effect is as follows, simple file server is complete

4 modify the default directory

 In order to avoid the release of documents more than enough to lead to the default directory space, I have changed a bit put the file directory, the directory I put the folder / sh, another mount, how to mount in front of a written, will not be look

Into the configuration file vi /etc/httpd/conf/httpd.conf modify the path, the next shot is to be changed a bit, in order to modify the error can first comment out, the number of lines can be built through esc, and then shft +: Enter the set nu, it you can display

 

 

 

 

 Then you can restart the httpd, find the file in the default path is not the original, which is modified into your own directory, and then create a file, or download files into the test,

 

 

 Then restart the httpd, the test page, the effect is as follows

It should be noted here is that if the Chinese do not need garbled, then he needs to AddDefaultCharset UTF-8 into AddDefaultCharset OFF, or to modify the vi /etc/httpd/conf/httpd.conf inside:

 

 

 

Modify the configuration file parameters:

# vim /etc/httpd/conf/httpd.conf profile parameters which need at our disposal,

 

57 ServerRoot "/ etc / httpd" root directory #apache profile

70 Timeout 60 # timeout, the timeout in seconds before sending and receiving

136 Listen 80 # listening port

262 ServerAdmin root @ localhost # administrator settings, e-mail address

277 ServerName 192.168.1.163:80 # server host name.

293 DocumentRoot "/ var / www / html" # root directory of Web pages

Options Indexes FollowSymLinks # when a directory is not the default home page, this allows the display of a directory listing

Apache is prohibited to display the directory structure of the list, just Option of Indexes can be removed

403 DirectoryIndex index.html index.html.var # specify the default home page

coding:

AddDefaultCharset UTF-8 # Set the server's default encoding is: UTF-8

Guess you like

Origin www.cnblogs.com/guizjiang/p/11519236.html