环境配置
1.将文件 nginx_phpMultiVersionIMG-14A.tar.gz 放在 root文件夹下面
2.在 root 文件夹下 ls 一下查看 nginx_phpMultiVersionIMG-14A.tar.gz 文件是否存在
3.存在的话在命令行内执行解压命令 tar -zxvf nginx_phpMultiVersionIMG-14A.tar.gz
4.解压后执行 ls 查看 nginx_phpMultiVersionIMG 文件是否解压出现 如果在的话 ls
5.执行文件 install.sh 命令为 sh install.sh ...然后等待安装完成。
6./alidata 当这个文件夹生成后即环境配置完成
虚拟机及域名解析
1.在 /alidata/server/nginx-1.7.9/conf/vhosts 中开始配置虚拟机
(1)新建文件夹 与将要用到域名相对于如域名为 tianjinhui.site 即 文件名为 tianjinhui.conf
内容为
server {
listen 80;
server_name xxx.com www.xxx.com; /*绑定对应域名*/
index index.html index.htm index.php;
root /alidata/www/xxx; /*设置代码放置读取位置---如没有就新建*/
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#伪静态规则
include /alidata/server/nginx/conf/rewrite/thinkphp.conf; /*伪静态文件配置位置------如没有需新建*/
access_log /alidata/log/nginx/access/xxx.log; /*网站浏览日志*/
}
(2)放入伪静态规则文件 /alidata/server/nginx-1.7.9/conf/rewrite/thinkphp.conf
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
2.以上部署完成后执行重新部署命令 /etc/init.d/nginx reload
如果在所有东西都设置好了后,登录网址有报错误,就给服务器内文件设置一个777权限
递归文件777权限命令: chmod 777 -R 文件夹路径