2017-07-07 51 views
0

我试图重写nginx的网址,打击是我的示例代码:
Nginx的URL重写错误:[EMERG]意外的“}”

server { 
    listen 80; 
    server_name example.com; 
    root /full/server/path/to/your/cms; 
    index index.php; 

    location/{ 
     try_files $uri $uri/ /phphandler 
    } 

    location /phphandler { 
     internal; 
     # nested location to filter out static items not found 
     location ~ .php$ { 
      rewrite ^/([^/]*)(.*) /$1 break; 
      fastcgi_pass 127.0.0.1:8080; 
      ... 
     } 
    } 
} 

我使用管理向导,当我添加此块的从Linux手动或从管理向导代码,我面临着同样的错误:

nginx的:[EMERG]在 /usr/local/directadmin/data/users/admin/nginx.conf意外 “}”: 178 nginx: 配置文件/etc/nginx/nginx.conf测试失败

注意:我复制粘贴从Here

这个代码的和平与我怀疑我的问题是在3点(...)是(fastcgi_pass 127.0.0.1:8080;后)我觉得我应该在这里添加一些我不知道的东西?!

在这段代码中有什么我想念的吗?
或者还有另一个问题,我面对这个错误?
感谢任何人谁帮助我解决这个问题:)提前

+2

缺少','的'try_files'语句的结束。 –

回答

0

的问题是,你在try_files结束错过;
但这也没有太大的帮助。
正如你所说你正在使用DirectAdmin,我建议你使用Nginx - Apache Reverse proxy。所有的
首先确保你有custombuild 2

cd /usr/local/directadmin/custombuild 
./build version 

您应该看到类似以下的输出:

2.0.0-RC7 (rev: 863) 

还要确保有管理向导的版本不能少比1.45.2要好,否则事情就不会奏效。

/usr/local/directadmin/directadmin v 

运行该代码来构建的nginx + apache的与custombuild:

cd /usr/local/directadmin/custombuild 
./build update 
./build update_da 
./build set webserver nginx_apache 
./build nginx_apache 
./build rewrite_confs