在配置apache的虚拟主机的时候,设置如下:
<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/share
ServerName tt.dd.com
ErrorLog /www/logs/dummy-host.example.com-error_log
CustomLog /www/logs/dummy-host.example.com-access_log common
php_value error_reporting 7
RewriteEngine On
RewriteRule ^(/themes/.*)$ $1 [L,QSA]
RewriteRule ^(.*\.)(php|xml|txt|jpg|gif|png|swf|css|js|html|htm)$ $1$2 [L,QSA]
RewriteRule ^/p/(\d+)/(\d+)$ /album/image-id-$1-size-$2
RewriteRule ^/(\w+)$ /$1/ [R=301,L,QSA]
RewriteRule ^/(\w+/\d+/\w+)$ /$1/ [R=301,L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?_RW_=$1 [L,QSA]
</VirtualHost>
apache重启的时候,报文件目录没找到
[root@bogon www]# service httpd start
正在启动 httpd:Warning: DocumentRoot [/www/share] does not exist
httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[失败]
[root@bogon www]# ^C
可是明明/www/share的文件夹已经存在,权限也设置好了。找了很久的原因,原来是seLinux的错误。关于seLinux的资料,网上很多,就不细讲。解决方案是:
/usr/bin/setenforce 是用来修改SELinux的实时运行模式的 临时打开: setenforce 1 ----设置SELinux 成为enforcing模式 临时关闭: setenforce 0 ----设置SELinux 成为permissive模式 如果要彻底禁用SELinux 需要在/etc/sysconfig/selinux中设置参数selinux=0 ,或者在/etc/grub.conf中添加这个参数 /usr/bin/setstatus -v就是关闭selinux就可以了。解决方案,是网上找的。不过,我找了很久才找到。特此整理