一,FTP用SFTP over SSH模式,端口号22,进入服务器
如果SFTP进不去,直接用Secure Shell Client 软件登录
image.png
image.png
image.png
输入ps -ef | grep nginx 查看nginx启动位置与配置目录
输出
root 8441 1 0 Mar23 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
则代表nginx启动目录为 /usr/local/nginx/sbin/nginx 配置文件位置 /usr/local/nginx/conf/nginx.conf
然后查看nginx.conf文件,找到include vhosts/*.conf;则代表站点配置文件都在vhosts/下面
vhosts/下新建文件 站点名.conf,如 website.conf
server {
listen 80;
server_name 域名;
root 站点目录;
index index.php index.html;
charset utf-8;
location = /robots.txt { allow all; access_log off; log_not_found off; }
location = /favicon.ico { allow all; access_log off; log_not_found off; }
error_page 401 /401.html;
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
*这里改动非常重要,不能落下*
location ~ .*\.(php|php5)?($|/)
{
fastcgi_param SCRIPT_FILENAME 站点目录/$fastcgi_script_name;
*最主要是下边这两句*
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
如果上面的配置不可用,改为下面这种方式尝试
*这里改动非常重要,不能落下*
location ~ .*\.(php|php5)?($|/)
{
fastcgi_param SCRIPT_FILENAME 站点目录/$fastcgi_script_name;
*最主要是下边这两句*
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
二,Codeigniter修改
对application/config/config.php进行修改,大约在55行左右。
$config['uri_protocol'] = "PATH_INFO";
三,登录SSH Secure Shell,输入命令
nginx -s reload :修改配置后重新加载生效
或
/usr/local/nginx/sbin/nginx -s reload尝试
再次访问则可生效
其他nginx命令:
service nginx restart 重启
service nginx stop 停止
service nginx start 启动
网友评论