dpkiubcc265650 2015-10-27 22:30
浏览 50

在WT-NMP上设置nginx配置

I have the following configuration added to nginx.conf:

server {
    server_name domain.vhost;
    root C:/WT-NMP/WWW/domain.vhost/web;

    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /app.php$is_args$args;
    }
    # DEV
    # This rule should only be placed on your development environment
    # In production, don't include this and don't deploy app_dev.php or config.php
    location ~ ^/(app_dev|config)\.php(/|$) {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include nginx.fastcgi.conf;
        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
        # for more information).
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
    }
    # PROD
    location ~ ^/app\.php(/|$) {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include nginx.fastcgi.conf;
        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
        # for more information).
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        # Prevents URIs that include the front controller. This will 404:
        # http://domain.tld/app.php/some-path
        # Remove the internal directive to allow URIs like this
        #internal;
    }

    error_log C:/WT-NMP/log/domain.vhost.error.log;
    access_log C:/WT-NMP/log/domain.vhost.access.log;
}

The problem is that it doesn't work. It does on my Ubuntu server. It does not on my windows WT-NMP nginx local machine. There are no logs showing up, and the only URL I can access is:

domain.vhost/domain.vhost/web/app_dev.php/, as when I enter domain.vhost/ I get the list of files on server to choose from.

What's wrong?

  • 写回答

1条回答 默认 最新

  • dqroc48068 2015-12-17 22:29
    关注

    You copy/pasted directives from your linux server without understanding them. The WT-NMP server stack for Windows generates the Nginx config file when you create a new project. Start by creating a new project and carefully modifying it's configuration file conf\domains.d\myProject.conf, with directives from your other machine..

    WT-NMP: How to create a new Project

    And since you seem to use a custom sub directory for public files, read

    WT-NMP: How to change the root directory of a project

    Also, the NGINX Documentation should help..

    Tips: do not copy fastcgi_pass or fastcgi_split_path_info directives from your linux server

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图