nginx创建多个站点和SVN管理多个项目!!!

1:首先设置一个二级域名

2:

cd  /

lnmp vhost add 增加一个项目

项目名:itbull.com

是否使用别名:n

放置的目录:/home/work/itbull

allow rewrite

n

allow access_log

y

access log file :直接回车


是否建立mysql同名:

n

直接回车


lnmp vhost list

cd /usr/local/nginx/conf/vhost/



vim  itbull.com.conf



两个项目文件都设置成这样



server
    {
        listen 80;
        #listen [::]:80;
        server_name qingtianvip.com;
        index index.php;
        root  /home/work/qingtianvip;


        location / {
        index  index.php index.html index.htm;  //这里配置默认访问的页面
    }
    location ~* \.php$ {   //这里配置php解析.php文件

        fastcgi_index   index.php;
        fastcgi_pass    127.0.0.1:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
    error_page 404 /404.html;   //默认的错误页面
        location = /40x.html {
    }
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
    }

配置完直接执行

lnmp restart

最后还得配置nginx.conf

cd /usr/local/nginx/conf/

vim nginx.conf

user nobody nobody;
worker_processes 2;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
events
{
    use epoll;
    worker_connections 6000;
}
http

{
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  65;
    client_max_body_size        13m;
    #gzip  on;
    include /etc/nginx/vhost/*.conf;

server

{
    listen 80;
    server_name localhost;
    index index.html index.htm index.php;
    root /usr/local/nginx/html;

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/tmp/php-fcgi.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
    }
}
}

一定要设置下面:否则不起作用

vim /etc/hosts



127.0.0.1  qingtianvip.com
127.0.0.1  tp.qingtianvip.com
;::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

这样创建站点就ok了


接下来用SVN创建项目

mkdir svn/

svnadmin create /svn/qingtian/

svnadmin create /svn/sian/

我这里是创建了两个项目

3、进入qingtian目录下的conf文件夹。将其中的authz与passwd文件复制到svn目录下

# cd /svn/qingtian/conf

# cp authz ../../

# cp passwd ../../

4、修改qingtian/conf下的svnserve.conf文件,将其中的passwd文件制定与authz文件制定进行修改,其他配置按正常单svn配置。(sifan同样一遍设置

 

anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = ../../passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = ../../authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = My First Repository
5、修改复制出来的/svn目录下的passwd文件与authz文件 

passwd文件:设置账号密码 

authz:

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
team1=zhiliang
team2=liang
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
[/]
* = rw
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[qingtian:/]
@team1 = rw
[sifan:/]
@team2 = rw
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

passwd

[users]
# harry = harryssecret
# sally = sallyssecret
zhiliang = 377122210
liang = 377122210

svnserve -d -r /svn (这里目录配到总目录,不是仓库目录)

7、其他 
在windows环境检出项目的时候, 
仓库1的检出地址为:svn://ip地址/sifan 

仓库2的检出地址为:svn://ip地址/qingtian

在每个文件的host中设置自动提交

8、在服务器检出

 svn co svn://119.29.214.197/qingtian   /home/work/qingtianvip 
svn co svn:// 119.29.214.197/sifan   /home/work/sifan

OK;




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值