The method of configuring pseudo-static of Nginx by Yii2
This article mainly introduces the Yii2 configuration Nginx pseudo-static method, combined with the example form analysis of the Yii2 framework for Nginx pseudo-static related configuration skills, friends need to refer to the following
This example describes the Yii2 configuration Nginx pseudo-static method. Share it for your reference, as follows:
Check the following codes:
location / { # Redirect everything that isn't a real file to index.php try_files $uri uri//index.php? uri/ /index.php? uri//index.php? args;}
Complete Code:
server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name mysite.local; root /path/to/basic/web; index index.php; access_log /path/to/basic/log/access.log; error_log /path/to/basic/log/error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri uri//index.php? uri/ /index.php? uri//index.php? args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ . (js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files KaTeX parse error: Expected 'EOF', got '#' at position 11: uri =404; #̲} #error_page 4…{ include fastcgi_params; fastcgi_param SCRIPT_FILENAME documentroot/document_root/documentroot/fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~ /. (ht|svn|git) { deny all; }}
More about Yii related content interested readers can view this site topics: "Yii framework introduction and common skills summary","php excellent development framework summary","smarty template introduction basic tutorial","php object-oriented programming introduction tutorial","php string (string) usage summary","php+mysql database operation introduction tutorial" and "php common database operation skills summary"
I hope this article will be helpful for PHP programming based on the Yii framework.
Article source: Search Engine Daquan www.iis7.com/b/ssyqdq/