apache2服务器的搭建和配置步骤详解

2019-01-17 00:08:36王振洲

注意这当中的一段:

<Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /usr/share> AllowOverride None Require all granted </Directory> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>

由这段可以很容易的知道apache2到底为哪些文件夹赋予了打开的权限了。以后就可以通过修改这里达到各种不可告人的目的了。

最后还有一个重要的配置,就是默认目录的更改。默认的目录其实是记录在:/etc/apache2/sites-available/000-default.conf 文件当中(在/etc/apache2/sites-enable/中也有一个指向他的链接):

myths@myths-X450LD:/etc/apache2/sites-available$ cat 000-default.conf <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

当中的“DocumentRoot ”键对应的值就是默认的目录了,可以任由我们修改了。

apache2的简单配置基本就是这些,不需要百度,我们也是完全可以自己弄清楚的。

注:

修改完配置文件后记得重启服务 可以顺手吧/var/www的权限设置为777方便修改网页

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对易采站长站的支持。

您可能感兴趣的文章:

Windows下SVN服务器搭建方法整理(apache)Windows下搭建PHP开发环境(Apache+PHP+MySQL)Windows下PHP开发环境搭建教程(Apache+PHP+MySQL)基于Apache的支持.NET2.0的Web服务器搭建mac下Apache + MySql + PHP搭建网站开发环境Mac OS上搭建Apache+PHP+MySQL开发环境的详细教程nginx+apache+mysql+php+memcached+squid搭建集群web环境PHP+Apache+Mysql环境搭建教程简单介绍win7下搭建apache+php+mysql开发环境windows下apache搭建php开发环境