nginx accesses the specified directory based on the information in the URL
淡淡烟草味
淡淡烟草味 2017-05-16 17:19:55
0
2
551

For example, my current URL (beautified URL) is
/1/test/test
Then nginx does the processing, and the access directory is /home/data/segmentfault/1/web
After nginx Processing, the actual URL is
/1/web/index.php?test/test

Beautified URL
/2/test/test
The access directory is /home/data/segmentfault/2/web
The actual URL is
/2/web/index.php? test/test

Just select different folders based on the version number, and then the pathinfo mode will still take effect. The framework code is Yii2.

How to set the jump rules of nginx?
Or is there any relevant information? How to describe such an internal jump? Are there any proper nouns to describe it?

淡淡烟草味
淡淡烟草味

reply all(2)
巴扎黑

Use regular matching in location. When root sets the directory, read the regular matching content to assemble the path.
Related nginx terms: location, regular, set directive, map directive, root directive, alias directive.

为情所困

You don’t need to do any extra settings at all with this access method. . .

server {
        listen 80;
        server_name segmentfault.com;
        include enable-php.conf;
        location ~ \.php$ {
        include fastcgi.conf;
        }
        root /home/data/segmentfault;
        index index.html index.php;
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template