【问题标题】:Add domain to subfolder with Nginx使用 Nginx 将域添加到子文件夹
【发布时间】:2016-06-24 17:14:15
【问题描述】:

我有很多项目,例如 /var/www/html/test、/var/www/html/test1 等。 只想将我的域附加到这些文件夹之一。 操作系统是 Debian。这是我的站点可用配置

server {
    server_name example.me;

    root /var/www/html/example.me;
    index index.html index.php;

    # set expiration of assets to MAX for caching
    location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
            expires max;
            log_not_found off;
    }

    location / {
            # Check if a file or directory index file exists, else route it to index.php.
            try_files $uri $uri/ /index.php;
    }

    location ~* \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            include fastcgi.conf;
    }

}

我希望有人能帮我解决这个问题。

【问题讨论】:

  • 它是符号链接到启用站点的?

标签: php nginx


【解决方案1】:

以下内容将使您的test 文件夹在example.me 可用。

  • 将您的root /var/www/html/example.me; 更改为root /var/www/html/test;
  • 将您的站点配置文件复制或符号链接到sites-enabled
  • 重启nginx

在不同的站点配置文件中使用 test1 并使用正确的 server_nameroot 重复相同的过程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-05-10
    • 2016-11-11
    • 2013-08-21
    • 1970-01-01
    • 2012-12-03
    • 2016-11-09
    • 2015-05-27
    • 1970-01-01
    相关资源
    最近更新 更多