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
阅读(1357) | 评论(0) | 转发(0) |