nginx 配置
[root@web02 zh]# cat /etc/nginx/conf.d/edu.conf server { listen 80; server_name edu.oldboy.com; root /code/edu/web; index app.php index.php index.html; location / { index app.php; try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } location ~ ^/udisk { internal; root /code/edu/app/data/; } location ~ ^/(app|app_dev).php(/|$) { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect; fastcgi_param HTTP_X-Accel-Mapping /udisk=/code/edu/app/data/udisk; fastcgi_buffer_size 128k; fastcgi_buffers 8 128k; } #配置设置图片格式文件 location ~* .(jpg|jpeg|gif|png|ico|swf)$ { #过期时间为3年 expires 3y; access_log off; #关闭日志记录 #关闭gzip压缩,减少cpu消耗,因为图片的压缩率不高 gzip off; } #配置css/js 文件 location ~* .(css|js)$ { access_log off; expires 3y; } #禁止用户上传目录下所有.php程序,提高安全性 location ~ ^/files/.*.(php|php5)$ { deny all; } #以下配置允许.php程序,方便于其他第三方系统的集成 location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; include fastcgi_params; } }
浏览器输入 edu.oldboy.com 访问
安装zh
[root@web02 zh]# cat /etc/nginx/conf.d/zh.conf server { listen 80; server_name zh.oldboy.com; root /code/zh; index index.php index.html; location ~ .php$ { root /code/zh; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
浏览器访问 zh.oldboy.com
修改 /code/zh/system目录权限为777
chmod 777 /code/zh/system
创建目录并修改权限
[root@web02 ~]# mkdir /code/zh/{tmp,cache,uploads} [root@web02 ~]# chmod 777 /code/zh/{tmp,cache,uploads}
暂时用root用户登陆
创建数据库
create databases zh;