lamp环境搭建完成后,装了discuz论坛。配置完了图片缓存,想用curl测试下是否成功。发现curl不能用。
hosts 已经设置好的。
网页端是能访问的
vhosts配置如下
Options Indexes
AllowOverride all
Require all granted
#虚拟主机
DocumentRoot "/data/xuni/"
ServerName www.123.com
DocumentRoot "/data/bbs"
ServerName www.bbs.zy.com
ServerAlias www.bbs.com
ErrorLog "logs/bbs-error_log"
SetEnvIf Request_URI ".*\.gif$" image-request
SetEnvIf Request_URI ".*\.jpg$" image-request
SetEnvIf Request_URI ".*\.png$" image-request
SetEnvIf Request_URI ".*\.bmp$" image-request
SetEnvIf Request_URI ".*\.swf$" image-request
SetEnvIf Request_URI ".*\.js$" image-request
SetEnvIf Request_URI ".*\.css$" image-request
CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/bbs-access_%Y%m%d_log 86400" combined env=!image-request
#301跳转
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bbs.zy.com$
RewriteRule ^/(.*)$ http://www.bbs.com/$1 [R=301,L]
RewriteRule ^/(.*)\.png$ /static/image/common/fav.gif [R=302]
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page%3D$2
RewriteRule ^/topic-(.+)\.html$ /portal.php?mod=topic&topic=$1&%1
RewriteRule ^/article-([0-9]+)-([0-9]+)\.html$ /portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^/forum-(\w+)-([0-9]+)\.html$ /forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^/group-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^/space-(username|uid)-(.+)\.html$ /home.php?mod=space&$1=$2&%1
RewriteRule ^/blog-([0-9]+)-([0-9]+)\.html$ /home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^/archiver/(fid|tid)-([0-9]+)\.html$ /archiver/index.php?action=$1&value=$2&%1
RewriteRule ^/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ /plugin.php?id=$1:$2&%1
RewriteCond %{HTTP_USER_AGENT} ^.*Firefox/4.0* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*curl* [NC]
RewriteRule .* - [F]
#用户认证配置
AllowOverride AuthConfig
AuthName "yahetz"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
#图片缓存配置
ExpiresActive on
ExpiresByType image/gif "access plus 1 days"
ExpiresByType image/jpeg "access plus 2 hours"
ExpiresByType image/png "access plus 2 hours"
ExpiresByType text/css "now plus 2 hour"
ExpiresByType application/x-javascript "now plus 2 hours"
ExpiresByType application/javascript "now plus 2 hours"
ExpiresByType application/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
hosts 已经设置好的。
网页端是能访问的
vhosts配置如下
Options Indexes
AllowOverride all
Require all granted
#虚拟主机
DocumentRoot "/data/xuni/"
ServerName www.123.com
DocumentRoot "/data/bbs"
ServerName www.bbs.zy.com
ServerAlias www.bbs.com
ErrorLog "logs/bbs-error_log"
SetEnvIf Request_URI ".*\.gif$" image-request
SetEnvIf Request_URI ".*\.jpg$" image-request
SetEnvIf Request_URI ".*\.png$" image-request
SetEnvIf Request_URI ".*\.bmp$" image-request
SetEnvIf Request_URI ".*\.swf$" image-request
SetEnvIf Request_URI ".*\.js$" image-request
SetEnvIf Request_URI ".*\.css$" image-request
CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/bbs-access_%Y%m%d_log 86400" combined env=!image-request
#301跳转
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bbs.zy.com$
RewriteRule ^/(.*)$ http://www.bbs.com/$1 [R=301,L]
RewriteRule ^/(.*)\.png$ /static/image/common/fav.gif [R=302]
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page%3D$2
RewriteRule ^/topic-(.+)\.html$ /portal.php?mod=topic&topic=$1&%1
RewriteRule ^/article-([0-9]+)-([0-9]+)\.html$ /portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^/forum-(\w+)-([0-9]+)\.html$ /forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^/group-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^/space-(username|uid)-(.+)\.html$ /home.php?mod=space&$1=$2&%1
RewriteRule ^/blog-([0-9]+)-([0-9]+)\.html$ /home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^/archiver/(fid|tid)-([0-9]+)\.html$ /archiver/index.php?action=$1&value=$2&%1
RewriteRule ^/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ /plugin.php?id=$1:$2&%1
RewriteCond %{HTTP_USER_AGENT} ^.*Firefox/4.0* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*curl* [NC]
RewriteRule .* - [F]
#用户认证配置
AllowOverride AuthConfig
AuthName "yahetz"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
#图片缓存配置
ExpiresActive on
ExpiresByType image/gif "access plus 1 days"
ExpiresByType image/jpeg "access plus 2 hours"
ExpiresByType image/png "access plus 2 hours"
ExpiresByType text/css "now plus 2 hour"
ExpiresByType application/x-javascript "now plus 2 hours"
ExpiresByType application/javascript "now plus 2 hours"
ExpiresByType application/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
0
{:6_137:}selinux关了吗?iptables清空了吗?
zyos 发表于 2016-5-7 16:54
把配置文件的curl 项 去掉了也不行。还是不能访问,而且在网页端,也不能访问?
{:6_137:}selinux关了吗?iptables清空了吗?
0
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bbs.zy.com$
RewriteRule ^/(.*)$ http://www.bbs.com/$1 [R=301,L]
RewriteRule ^/(.*)\.png$ /static/image/common/fav.gif [R=302]
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page%3D$2
RewriteRule ^/topic-(.+)\.html$ /portal.php?mod=topic&topic=$1&%1
RewriteRule ^/article-([0-9]+)-([0-9]+)\.html$ /portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^/forum-(\w+)-([0-9]+)\.html$ /forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^/group-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^/space-(username|uid)-(.+)\.html$ /home.php?mod=space&$1=$2&%1
RewriteRule ^/blog-([0-9]+)-([0-9]+)\.html$ /home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^/archiver/(fid|tid)-([0-9]+)\.html$ /archiver/index.php?action=$1&value=$2&%1
RewriteRule ^/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ /plugin.php?id=$1:$2&%1
RewriteCond %{HTTP_USER_AGENT} ^.*Firefox/4.0* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*curl* [NC] 这段注释点
RewriteRule .* - [F]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bbs.zy.com$
RewriteRule ^/(.*)$ http://www.bbs.com/$1 [R=301,L]
RewriteRule ^/(.*)\.png$ /static/image/common/fav.gif [R=302]
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page%3D$2
RewriteRule ^/topic-(.+)\.html$ /portal.php?mod=topic&topic=$1&%1
RewriteRule ^/article-([0-9]+)-([0-9]+)\.html$ /portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^/forum-(\w+)-([0-9]+)\.html$ /forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^/group-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^/space-(username|uid)-(.+)\.html$ /home.php?mod=space&$1=$2&%1
RewriteRule ^/blog-([0-9]+)-([0-9]+)\.html$ /home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^/archiver/(fid|tid)-([0-9]+)\.html$ /archiver/index.php?action=$1&value=$2&%1
RewriteRule ^/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ /plugin.php?id=$1:$2&%1
RewriteCond %{HTTP_USER_AGENT} ^.*Firefox/4.0* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*curl* [NC] 这段注释点
RewriteRule .* - [F]
0
试过了
robb 发表于 2016-5-7 19:54
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bbs.zy.com$
RewriteRule ^ ...
试过了
0
我已经用这种方法试出了是伪静态这段配置有问题的,但是伪静态配置这里也关掉了curl这行。也还是不行
阿铭 发表于 2016-5-8 08:24
这样吧,你把你的配置项,全部注释,然后一段一段地打开,这样尝试,总能把问题试出来。
我已经用这种方法试出了是伪静态这段配置有问题的,但是伪静态配置这里也关掉了curl这行。也还是不行
0
HWQH - 学习,学习!赚钱,赚钱!
crul -x192.168.137.10:80 www.bbs.com -i
用这个试试,你的hosts缓存设置的是啥你用那个,别把172和你指定的bbs。com一起用
用这个试试,你的hosts缓存设置的是啥你用那个,别把172和你指定的bbs。com一起用
编辑回复