文件內容如下:
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
修改為:
location / {
if (!-e $request_filename) {
rewrite ^/([0-9] )$ /index.php?m=Show&a=index&roomnum=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
2:創(chuàng)建 vim /usr/local/nginx/conf/pathinfo.conf 文件,并保存以下內容
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "(. ?\\\\.php)(/.*)") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
3:編輯 /usr/local/nginx/conf/vhost/域名.conf 文件
location ~ \\\\.php {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
# include fastcgi_params;
include fastcgi.conf;
}
在include fastcgi.conf; 下?面加入一句
include pathinfo.conf;
4:修改/usr/local/php/etc/php.ini,搜索cgi.fix_pathinfo,把值從0改成1
部署web項目代碼
1:將代碼拷貝到目錄 /data/wwwroot/域名/
2:修改文件夾權限。這個是根據框架需求。一般是上傳文件或者寫入日志的文件夾需要開啟權限。laravel 是 storage bootstrap 文件夾需要賦值權限
chmod -R 777 /data/www/域名/data/runtime chmod -R 777 /data/www/域名/api/Runtime
3:編輯以下文件,修改數據庫配置和redis配置
/api/Config/app.php /api/Config/dbs.php /data/conf/db.php
4:重啟服務器
service mysqld restart // 重啟數據庫 service php-fpm restart // 重啟php systemctl restart redis-server // 重啟redis systemctl restart nginx // 重啟nginx
開放端口
以下端口不在開放端口行列,則需要開放
80 19967 // node.js端口
更多關于云服務器,域名注冊,虛擬主機的問題,請訪問西部數碼官網:m.ps-sw.cn