原來在winserver+Apache環境下工作良好的一個微信公眾號后臺遷移到阿里云(環境:Ubuntu 64位 | php5.4 | Nginx1.6)下卻頻出 404,403,只能訪問CI routes.php中設置的默認控制器等問題,后來上網查里下可能是路由設置問題,幾經折騰最后按下面的設置解決問題。
1、修改網站配置文件
server { 2 listen 80; 3 server_name example.com;//自己的域名 4 5 root /alidata/www/example;//網站目錄 6 index index.php index.htm index.html; 7 8 location / { 9 try_files $uri $uri/ /index.php;10 }11 12 location /index.php{13 fastcgi_pass 127.0.0.1:9000;14 fastcgi_param SCRipT_FILENAME /alidata/www/example/index.php;15 fastcgi_param PATH_INFO $fastcgi_path_info;16 fastcgi_split_path_info ^(.+/.php)(.*)$;17 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;18 include fastcgi.conf;19 }20 21 }2、修改CI 的config.php 文件
$config['base_url'] = 'http://example.com/';
$config['uri_ $config['index_page'] = ''; 3、網站根目錄以及以下目錄設置讀寫權限(777) 4、重啟nginx
新聞熱點
疑難解答