最近用codeigniter搞一个php项目,nginx不太熟悉,好不容易配置好了,记录一下。
以下为nginx配置
server { listen 9006; server_name localhost; root /opt/htdocs/site; autoindex on; index index.php; location / { try_files $uri $uri/ /index.php; location = /index.php { fastcgi_pass 127.0.0.1:9001; fastcgi_param SCRIPT_FILENAME /opt/htdocs/site$fastcgi_script_name; include fastcgi_params; } } location ~ \.php$ { return 444; } }
codeigniter配置做如下修改
$config['base_url'] = ""; $config['index_page'] = ""; $config['uri_protocol'] = "AUTO";