公司以前用的是apache環境,打算換成nginx,在將禪道移到nginx遇到了一些問題,以前一直認爲nginx只能用get方式訪問,今天研究禪道二次開發時發現能靜態友好(pathinfo)方式設置,並且這樣設置訪問的url比get方式訪問的美觀所以趕緊修改下博客,別誤人!
靜態友好方式(PATH_INFO)訪問設置 [root@test ~]# more /data/web/zendao/zentaopms/config/my.php <?php $config->installed = true; $config->debug = false; $config->requestType = 'PATH_INFO'; // apache使用,nginx pathinfo方式路由 //$config->requestType = 'GET'; //nginx GET使用方式 $config->db->host = '192.168.1.189'; $config->db->port = '3306'; $config->db->name = 'zendao'; $config->db->user = 'zdadmin'; $config->db->password = 'zenDao.0420'; $config->db->prefix = 'zt_'; $config->webRoot = getWebRoot(); $config->default->lang = 'zh-cn'; $config->mysqldump = '/usr/local/mysql/bin/mysqldump'; server { listen 80; rewrite_log on; server_name zd.tiger.com; #charset koi8-r; #access_log logs/host.access.log main; location / { root /data/web/zendao/zentaopms/www; index index.html index.htm index.php; try_files $uri $uri/ /index.php?$args; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root /data/web/zendao/zentaopms/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $request_uri; include fastcgi_params; } } GET訪問方式設置 [root@test ~]# more /data/web/zendao/zentaopms/config/my.php <?php $config->installed = true; $config->debug = false; //$config->requestType = 'PATH_INFO'; //apache使用,nginx pathinfo方式路由 $config->requestType = 'GET'; //nginx get使用方式 $config->db->host = '192.168.1.189'; $config->db->port = '3306'; $config->db->name = 'zendao'; $config->db->user = 'zdadmin'; $config->db->password = 'zenDao.0420'; $config->db->prefix = 'zt_'; $config->webRoot = getWebRoot(); $config->default->lang = 'zh-cn'; $config->mysqldump = '/usr/local/mysql/bin/mysqldump'; server { listen 80; rewrite_log on; server_name zd.tiger.com; #charset koi8-r; #access_log logs/host.access.log main; location / { root /data/web/zendao/zentaopms/www; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root /data/web/zendao/zentaopms/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }