【问题标题】:OROCRM Nginx Virtual Host Configuration Not WorkingOROCRM Nginx 虚拟主机配置不工作
【发布时间】:2017-02-23 17:52:23
【问题描述】:

我已经在带有 Nginx 和 PHP7 的 AWS Lightsail VPS 上安装了一个 orocrm。 orocrm 安装顺利,但我是第一次使用 Nginx,我的虚拟主机似乎无法正常工作。

网站可用/默认: 服务器 { 听 80 default_server; 听 [::]:80 default_server;

        root /var/www/html;
        index app.php index.php index.html;
        server_name 34.127.224.10;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
                fastcgi_pass   unix:/run/php/php7.0-fpm.sock;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                include        fastcgi_params;
        }

        location ~ /\.ht {
                deny all;
        }
}

然后我购买了 crmdomain.com 并将其指向我的实例并创建了另一个文件。

网站可用/crm:

server {
        listen 80;
        server_name crmdomain.com www.crmdomain.com;
        root /var/www/html/crm/web;

        index app.php;

        error_log /var/log/nginx/orocrm_error.log;
        access_log /var/log/nginx/orocrm_access.log;

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }

        location @rewrite { rewrite ^/(.*)$ /app.php/$1; }

        location / {
                try_files $uri /app.php$is_args$args;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                if (!-f $document_root$fastcgi_script_name) {
                        return 404;
                }
                fastcgi_index app.php;
                fastcgi_read_timeout 10m;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

老实说,我不知道上面的大部分内容,它主要基于教程和 apache 经验。

错误

基于域

 - crmdomain.com -> 403 Forbidden nginx/1.10.0 (Ubuntu)
 - crmdomain.com/app.php -> No input file specified.
 - crmdomain.com/app_dev.php -> No input file specified.
 - crmdomain.com/index.nginx-debian.html -> Welcome to nginx!
 - crmdomain.com/user/login -> 404 Not Found nginx/1.10.0 (Ubuntu) **This is what should word**

基于静态 IP

 - 34.127.224.10 -> 403 Forbidden nginx/1.10.0 (Ubuntu)
 - 34.127.224.10/crm/web/ - No input file specified.
 - 34.127.224.10/crm/web/app.php - No input file specified.
 - 34.127.224.10/crm/web/app_dev.php - No input file specified.
 - 34.127.224.10/index.nginx-debian.html -> Welcome to nginx!
 - 34.127.224.10/crm/web/app.php/user/login -> 404 Not Found nginx/1.10.0 (Ubuntu) **This is what should word**

我做错了什么?

【问题讨论】:

    标签: php apache symfony nginx orocrm


    【解决方案1】:

    我回答自己的问题的频率很奇怪:

    我能够更改默认文件并删除额外的虚拟主机。因为服务器只会托管一个应用程序。

    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
            server_name 34.127.224.10 crmdomain.com www.crmdomain.com;
            root /var/www/html/crm/web;
            index app.php app_dev.php index.php;
    
            location / {
                    # try to serve file directly, fallback to app.php
                    try_files $uri /app.php$is_args$args;
            }
    
        location ~ ^/(app|app_dev|config|install)\.php(/|$) {
                #fastcgi_pass 127.0.0.1:9000;
                # or
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param HTTPS off;
        }
    
            error_log /var/log/nginx/orocrm_error.log;
            access_log /var/log/nginx/orocrm_access.log;
    }
    

    【讨论】:

      猜你喜欢
      • 2016-09-19
      • 2015-10-13
      • 1970-01-01
      • 2011-02-22
      • 2012-12-24
      • 2019-03-22
      • 1970-01-01
      • 2014-07-04
      相关资源
      最近更新 更多