Last update at :2024-07-05,Edit by888u
Due to the special needs, many of our CMS programs or specific environments need to support the pathinfo mode path function. For example, in the morning, the Typecho CMS program used by a netizen needed to support pseudo-static paths like https:/ /www.laozuo.org/index.php/article_info/id/10 Such format effect. In the default Nginx configuration environment, pathinfo mode is not supported. We need to set up startup.
First, AMH panel environment
If we use the AMH panel environment (Nginx), we also need to set it manually in the early days. Now it is very simple. We only need to download and activate the AMPathinfo module in the plug-in module.
If you use the AMH panel, it is relatively simple. You can activate it directly with the component and it will take effect. No configuration file is required.
Second, configure the Pathinfo function in the LNMP environment
If we use the one-click package, Snail starts the Pathinfo function in the LNMP environment of the one-click package provided by linuxeye.
1. Configure website .conf file
server {listen 80;server_name www.laozuo.org laozuo.org;access_log logs/www.laozuo.org.log combined;root /home/wwwroot/www.laozuo.org;error_page 404 /404.html;index index.html index.htm index.php ;location / {index index.php;if (!-e $request_filename) {rewrite ^/(.*)$ /index.php/$1 last;break;}}location ~ \ \\\.php {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fcgi_pathinfo.conf;set $real_script_name $fastcgi_script_name;if ($fastcgi_script_name ~ \\”^(.+?\\\\.php)( /.+)$\\”) {set $real_script_name $1;set $path_info $2;}fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;fastcgi_param SCRIPT_NAME $real_script_name;fastcgi_param PATH_INFO $path_info;}}
Refer to the site .conf file where we need to set the pathinfo function, and then modify it accordingly.
2. Modify the fcgi_pathinfo.conf file
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;#fastcgi_param SCRIPT_NAME $fastcgi_script_name;fastcgi_param QUERY_STRING $query_string;fastcgi_param REQUEST_METHOD $request_method;fastcgi_param CONTENT_TYPE $content_type;fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $request_uri;fastcgi_param DOCUMENT_URI $document_uri;fastcgi_param DOCUMENT_ROOT $document_root;fastcgi_param SERVER_PROTOCOL $server_protocol;fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;fastcgi_param REMOTE_PORT $remote_port;fastcgi_param SERVER_ADDR $server_addr;fastcgi_param SERVER_PORT $server_port;fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with –enable-force-cgi-redirectfastcgi_param REDIRECT_STATUS 200;
The 2 lines marked in red need to be #commented out.
To summarize, this can basically achieve the pathinfo path effect. From my personal use, if we are just for simple website building needs, we should not use this path. The user experience and search experience are very poor, so we should still use it. Ordinary pseudo-static or generated static is better. Unless we have special website environment needs, we have no way to use it.
Recommended site searches: all-purpose virtual host, same IP website query, game server defense, US ASP space, US high defense space, Alibaba Cloud domain name registration entrance, Qingdao IP proxy, foreign server, local IP query, permanent free cloud Server address,
发表评论