lamp搭建论坛不能curl

回复 收藏
lamp环境搭建完成后,装了discuz论坛。配置完了图片缓存,想用curl测试下是否成功。发现curl不能用。

1.png

hosts 已经设置好的。

2.png




网页端是能访问的
3.png


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"
   
2016-05-07 16:03 举报
已邀请:
0

阿铭 管理员

赞同来自:

curl 不能用,因为你限制了user_agent    RewriteCond %{HTTP_USER_AGENT}  ^.*curl* [NC]   去掉它或者修改一下
0

zyos

赞同来自:

本帖最后由 zyos 于 2016-5-7 17:04 编辑

把配置文件的curl 项  去掉了也不行。还是不能访问,而且在网页端,也不能访问?
1.png



0

maria

赞同来自:

zyos 发表于 2016-5-7 16:54
把配置文件的curl 项  去掉了也不行。还是不能访问,而且在网页端,也不能访问?

{:6_137:}selinux关了吗?iptables清空了吗?
0

robb

赞同来自:


        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

zyos

赞同来自:

maria 发表于 2016-5-7 17:40
selinux关了吗?iptables清空了吗?

早就清空了。要不然网页端也不能访问啊
0

zyos

赞同来自:

robb 发表于 2016-5-7 19:54
RewriteEngine on
        RewriteCond %{HTTP_HOST} ^www.bbs.zy.com$
        RewriteRule ^ ...

试过了
0

qq495966654

赞同来自:

重新搭建一遍看看,然后做个对比,这个先做个快照。
0

阿铭 管理员

赞同来自:

我以为有问题呢
0

zyos

赞同来自:

阿铭 发表于 2016-5-7 21:57
我以为有问题呢

把配置文件的curl 项  去掉了也不行。还是不能访问,而且在网页端,也不能访问?
0

阿铭 管理员

赞同来自:

这样吧,你把你的配置项,全部注释,然后一段一段地打开,这样尝试,总能把问题试出来。
0

zyos

赞同来自:

阿铭 发表于 2016-5-8 08:24
这样吧,你把你的配置项,全部注释,然后一段一段地打开,这样尝试,总能把问题试出来。

我已经用这种方法试出了是伪静态这段配置有问题的,但是伪静态配置这里也关掉了curl这行。也还是不行
0

BENDAN2016

赞同来自:

数据库没有设置好
0

HWQH - 学习,学习!赚钱,赚钱!

赞同来自:

crul -x192.168.137.10:80 www.bbs.com -i
用这个试试,你的hosts缓存设置的是啥你用那个,别把172和你指定的bbs。com一起用

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: