小编Aka*_*run的帖子

Nginx - 在其他目录和PHP中使用root的位置

我尝试使用Nginx设置类似"Apache Alias"的位置,但我无法在此文件夹中处理PHP脚本.

这是我的文件夹结构(适用于Dev环境):

/var/www
+-  dev/public/ <-- This is my normal Web root : "/"
|   +- assets/
|   |  +- app.css
|   |  +- app.js
|   |
|   +-  index.php
|   +-  favicon.png
|    
+-  cut/public/ <-- This must like an "Apache Alias" : "/cut"
    +- assets/
    |  +- app.css
    |  +- app.js
    |
    +-  index.php
    +-  other_other_file.php (why not)
Run Code Online (Sandbox Code Playgroud)

我尝试了不同的解决方案,但没有一个能正常工作.

这是我最好的Nginx配置:

server {
    listen   80;

    server_name _;
    root  /var/www/dev/public/;
    index index.php index.html;
    autoindex on;

    # Logs
    rewrite_log on; …
Run Code Online (Sandbox Code Playgroud)

php nginx nginx-location

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

nginx ×1

nginx-location ×1

php ×1