Nginx conf文件,用于多个网站,一个唯一。在树莓派服务器上

时间:2019-07-06 20:32:46

标签: nginx server debian

我最近将Raspberry服务器测试平台从Apache2转换为Nginx。
  ==== Debian Stretch上的nginx / 1.10.3和PHP 7.3.4-2 ====
在此之前,我为每个域的根文件夹都有一个唯一的htaccess文件。
一切都很好。
现在,我有一个唯一的网站(在Apache2中)需要一个唯一的htaccess,该网站位于网站“ goop”的子文件夹中。
让我们称之为 www / goop / uniq

Nginx站点可用 文件夹中-
如何从使用“默认”的其他网站中隔离或识别“ uniq”文件夹的新Nginx conf?

我为相关网站添加了一个唯一的.conf文件。所有其他网站应使用“可用网站”中已有的“默认”文件

**######## Default config used by all (except one) www index,php**
server {
    listen 80 default_server;
    listen [::]:80 default_server;
        error_page  404  /BIG404.php;
  .....etc etc  ............
   server_name _;
   root /media/USBdrive32/www;
    index index.php index.htm;
...............................
    location / {
    try_files $uri $uri/ =404;
    }
    # pass PHP scripts to FastCGI server  etc  etc 

..........................

**#######  config that should be used by just www/goog/uniq folder**-
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    .....etc etc  ............
   server_name BAMBOOZLE.com;
   root /media/USBdrive32/www;
   index index.php;
......................
     location  /goop/uniq/   {
     try_files $uri $uri/ index.php?$args;
      }

只是上面的基础知识-不用担心任何多余的或缺少的括号。
是的, sudo nginx -t 通常表示一切正常。
但是然后,通常uniq / index.php会下降到默认值404,并且不会使用“ uniq” conf文件。

我只希望Nginx与所有其他/ www / ....网站区别对待www / goop / uniq / index.php。
一切都应该放在一个大的DEFAULT文件中吗?还是每个唯一网站都有单独的.conf文件?如果是后者,我如何识别Nginx的每个.conf?

附录-哦,nginx / conf.d文件夹为空。

0 个答案:

没有答案