安装apache2.4
因为centos6.8的yum中默认是apache2.2的所以需要升级yum源
可参考:centos安装apache2.4
第一次service httpd start启动会报错:修改成以下
276 #ServerName www.example.com:80
277 ServerName localhost:80
开启:NameVirtualHost *:80
(将前面#去掉)
关于apache开启重写机制:
打开/etc/httpd/conf/httpd.conf配置文件:将一下两处AllowOverride All改为AllowOverride None
①:
302 <Directory />
303 Options FollowSymLinks
304 AllowOverride All
305 </Directory>
②:
317 <Directory "/var/www/html">
318
319 #
320 # Possible values for the Options directive are "None", "All",
321 # or any combination of:
322 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
323 #
324 # Note that "MultiViews" must be named *explicitly* --- "Options All"
325 # doesn't give it to you.
326 #
327 # The Options directive is both complicated and important. Please see
328 # http://httpd.apache.org/docs/2.2/mod/core.html#options
329 # for more information.
330 #
331 Options Indexes FollowSymLinks
332
333 #
334 # AllowOverride controls what directives may be placed in .htaccess files.
335 # It can be "All", "None", or any combination of the keywords:
336 # Options FileInfo AuthConfig Limit
337 #
338 AllowOverride All
339
340 #
341 # Controls who can get stuff from this server.
342 #
343 Order allow,deny
344 Allow from all
345
346 </Directory>
安装mysql5.5
可参考:centos6.8安装mysql5.6或者centos6.5安装mysql5.5
安装php5.6
可参考:centos安装php5.6或者参考安装php5.6
关于centos下配置多台虚拟主机步骤:
一、在/etc/httpd/conf.d/目录下添加一个文件(后缀以.conf皆为即可),因为在/etc/httpd/conf/httpd.conf配置中,Include conf.d/*.conf
表示回去cond.d中加载自定义的配置文件,所以一般不要修改主配置文件
内容为:
<VirtualHost *:80>
DocumentRoot /var/www/html/***(网站根目录)
ServerName www.****.com(域名)
ErrorLog /var/www/html/***/error.log(错误日志)
CustomLog /var/www/html/***/log.log common(这里后面的common参数不要忘记了,否则重启会报错)
</VirtualHost>
二、配置/etc/hosts文件
ip 域名
参考文章:配置多虚拟主机
tip:大神请绕道