0
我正在從Apache遷移到nginx,需要將大量的httaccess文件轉換爲nginx格式。nginx重寫2種方法的區別
我發現2種方式工作,我應該使用哪一種?
location = /test.html { rewrite ^(.*)$ /index.php?action=temp&name=test; }
或只是
rewrite ^/test.html$ /index.php?action=temp&name=test;
我把所有這一切在文件(ez_rewrite_list.conf),然後包括在virtual.conf。我應該在哪裏放置文件位置?有關係嗎?我做對了嗎?任何提示
server { listen 80; server_name test.com; location/{ root /var/www/com/mysite; index index.php index.html index.htm; } include /etc/nginx/ez_conf/ez_rewrite_list.conf; # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /var/www/com/mysite; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME document_root$fastcgi_script_name; include fastcgi_params; } }
明白了,謝謝 – bell2041