我的网站有个功能 比如 www.abc.com 对应的目录是 aaa 还有一个网站目录为 www.123.com 对bbb
但是需要在www.abc.com 上次文件的同事 往 www.123.com 里面也给生成一个同样的 文件。 但是原配设置是有问题的,传布上去。
查找思路:
1、文件权限问题
2、访问所属者
两个都查完了 发现都没问题, 郁闷了,最后想到 网站单独的配置文件的问题,于是打开 www.abc.com 对应的apache 配置文件:
<VirtualHost *:80>
DocumentRoot /www/web/system/aaa/public_html
ServerName www.abc.com
DirectoryIndex index.php
ErrorDocument 400 /errpage/400.html
ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html
ErrorDocument 405 /errpage/405.html
php_admin_value open_basedir /www/web/system/aaa:/tmp
<IfModule mod_deflate.c>
DeflateCompressionLevel 7
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js html htm gif jpg png bmp php
</IfModule>
</VirtualHost>
<Directory /www/web/system/aaa>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
发现多了一行,查看了一下 php_admin_value open_basedir 这个说白了是设置作用域。这里你设置一下便可解决问题。
设置方法:
可以在 :/tmp 后面在罗列允许访问的目录 :/** 同样也可以更改前面的目录 往上一级走。
一,安装BIND
1.下载BIND http://www.isc.org 也可以去本站下载 bind9 dns软件。
2.编译安装
# tar zxvf bind-9.4.0.tar.gz
# cd bind-9.4.0
# ./configure sysconfdir=/etc //更多安装选项 ./configure --help
# make
# make install
二,配置BIND
A.创建需要文件
1)./etc/named.conf
# vi /etc/named.conf 推出保存即可 或 touch /etc/named.conf
2)./etc/rndc.conf
# rndc-confgen > /etc/rndc.conf
B.创建目录 /var/named
# mkdir /var/named
B.编辑/etc/named.conf 内容如下
options {
directory "/var/named"; //表示默认的数据库文件在/var/named中 若没有需手动创建
// pid-file "/var/run/named/named.pid"; //运行的PID文件路径,用于使用其他用户启动named
};
zone "." { //创建root域
type hint;
file "named.ca";
};
zone "localhost" { //创建 localhost域
type master;
file "named.local";
};
zone "example.com" { //创建 example.com域
type master;
file "example.com.zone";
};
zone "0.0.127.in-addr.arpa"{ //localhost的反解析
type master;
file "127.0.0.zone";
};
zone "100.168.192.in-addr.arpa" { //example.com的反向解析
type master;
file "192.168.100.zone";
};
//这段文件在/etc/rndc.conf 的尾部需拷贝才能使用 # tail +13 /etc/rndc.conf >>/etc/named.conf
# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
algorithm hmac-md5;
secret "HWM3L+e7LWDZJJ/dJEzQEw==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf
D.在/var/named 中创建相应的数据文件 文件名由named.conf 中的file 参数制定
由named.conf可知有 named.ca, named.local, example.com.zone, 127.0.0.zone , 192.168.100.zone
1. named.ca
# dig -t NS . >/var/named/named.ca
2. named.local #vi /var/named/named.local 加入以下内容
$TTL 1D
@ IN SOA localhost. root (
2007042801
1H
15M
1W
1D )
IN NS @
IN A 127.0.0.1
3. example.com.zone
$TTL 1D
@ IN SOA example.com. root (
2007042801
1H
15M
1W
1D )
IN NS ns.example.com.
IN MX 10 mail.example.com.
IN A 192.168.100.125
www IN A 192.168.100.125
db IN A 192.168.100.124
ns IN A 192.168.100.126
mail IN A 192.168.100.251
shop IN A 192.168.100.125
*.shop IN A 192.168.100.124
news IN CNAME www
3. 127.0.0.zone
$TTl 1D
@ IN SOA @ root.localhost. (
2007042801
1H
15M
1W
1D
)
IN NS localhost.
1 IN PTR localhost.
4. 192.168.100.zone
$TTL 1D
@ IN SOA @ root.example.com. (
2007042801
1H
15M
1W
1D )
IN NS example.com.
125 IN PTR example.com.
125 IN PTR www.example.com.
124 IN PTR db.example.com.
126 IN PTR ns.example.com.
251 IN PTR mail.example.com.
补充说明
a. named服务器的启动问题
1. 启动 #named //以root用户启动
#named -u named //以named用户启动,必须有这个用户而且,named.pid的属主是 named
2. 更改配置后如何重启
# rndc reload
3.测试配置是否成功,可用 host, dig ,nslookup 判断
<Directory "/opt/fivetrees">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All #这里原先是None要改为All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
首先,在网站根目录下创建.htaccess文件,在最下面添加写入如下语句:
RewriteEngine on
RewriteBase / #我这行是没有配置
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]