Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2914351
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: LINUX

2011-11-16 17:08:49

1、编辑apache配置文件
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
添加一段:

    ServerAdmin liuyi@315zhaopin.com
    DocumentRoot "/data/home/aaaaa"
    ServerName  aaa.ddddd.com
    ServerAlias dddddd.com
    ErrorLog "logs/dddddd.com-error_log"
    CustomLog "logs/ddddddd.com-access_log" common

保存退出。
2、编辑apache权限文件
vim /usr/local/apache2/conf/extra/httpd-userdir.conf

    AllowOverride all
    Options MultiViews SymLinksIfOwnerMatch IncludesNoExec
    DirectoryIndex index.php
   
        Order allow,deny
        Allow from all
   

   
        Order deny,allow
        Deny from all
   


保存退出。
3、新建网站文件的文件夹
mkdir /data/home/aaaaa
4、新建FTP帐号:
useradd -d /data/home/aaaaa/ -s /sbin/nologin 用户名
passwd 用户名
vim /etc/vsftpd/chroot_list 
把这个用户添加进去,在新的一行添加即可。
5、给文件夹相应权限:
chown -R FTP用户名.daemon ./aaaaa/
chmod -R 4755 ./aaaaa/
6、添加 301跳转:
vim /data/home/aaaaa/.htaccess
内容如下:
RewriteEngine On
RewriteBase /
# Rewrite规则
RewriteRule ^index\.htm$ index\.php
RewriteRule ^jobs/jobs-show-([0-9]+)\.htm$ jobs/jobs-show\.php\?id=$1
RewriteRule ^company/company-show-([0-9]+)\.htm$ company/company-show\.php\?id=$1
RewriteRule ^resume/resume-show-([0-9]+)\.htm$ resume/resume-show\.php\?id=$1
RewriteRule ^news/news-list-([0-9]+)-([0-9]+)\.htm$ news/news-list\.php\?id=$1&page=$2
RewriteRule ^news/news-show-([0-9]+)\.htm$ news/news-show\.php\?id=$1
RewriteRule ^explain/explain-show-([0-9]+)\.htm$ explain/explain-show\.php\?id=$1
RewriteRule ^notice/notice-list-([0-9]+)-([0-9]+)\.htm$ notice/notice-list\.php\?id=$1&page=$2
RewriteRule ^notice/notice-show-([0-9]+)\.htm$ notice/notice-show\.php\?id=$1
RewriteEngine on
RewriteCond %{http_host} ^*****.com [NC]
RewriteRule ^(.*)$ *****.com/$1 [L,R=301]
# 404 page
ErrorDocument 404 /./404.php
保存退出。
7、重启服务
/etc/init.d/apachectl restart
/etc/init.d/vsftpd restart

8、操作数据库
mysql -uroot -p
create database ******;
grant all privileges on 数据库名称.* to 数据库的用户名@"%" identified by '密码';
flush privileges;
 exit
阅读(1313) | 评论(0) | 转发(0) |
0

上一篇:404错误页面

下一篇:apache 安全总结

给主人留下些什么吧!~~