Laravel代客安装(Nginx)和CMS(Perch跑道)

时间:2018-11-22 11:52:43

标签: php nginx url-rewriting laravel-valet perch

我正在尝试在代客服务台上设置Perch跑道。查看在Valet使用的Nginx设置上运行的Perch Runway CAN 文档。过去,您需要使用自定义Valet驱动程序来实现此目的,但现在不再需要。我已经设置了一个新的Valet实例,可以正常使用Perch Admin,但是...在查看前端站点时得到404。

我怀疑我需要根据perch documentation在Valet Nginx配置文件中设置一些重写规则(类似于.htaccess文件中所需的配置)。我试图使用Perch nginx配置信息对站点的代客配置文件进行修改,但是解决方案使我逃脱了,根据重新启动代客后我尝试执行的操作,我仍然看到各种404、403错误。我希望有更多经验的人可以看到解决方案。

预先感谢...

注意事项:

  • 根目录中的“ perch”文件夹已重命名为“ login”。

下面的文档

  • 旧鲈鱼跑道.htaccess配置以供参考
  • 根据官方文档推荐的Nginx Perch Config
  • 我的代客Nginx配置文件(无修改)
  • 我的代客Nginx配置文件(尝试的修正无效)

旧鲈鱼跑道.htaccess配置以供参考

 RewriteCond %{REQUEST_URI} !^/login
 RewriteCond %{REQUEST_FILENAME} !-f

推荐的Nginx Perch配置

# Match just the homepage
location = / {
    try_files $uri @runway;
}

# Match any other request
location / {
    try_files $uri $uri/ @runway;
}

# Perch Runway
location @runway {
    rewrite ^ /perch/core/runway/start.php last;
}

我的代客Nginx配置文件(无修改)

  server {
      listen 80;
      server_name armstrong.test www.armstrong.test *.armstrong.test;
      return 301 https://$host$request_uri;
  }

  server {
      listen 443 ssl http2;
      server_name armstrong.test www.armstrong.test *.armstrong.test;
      root /;
      charset utf-8;
      client_max_body_size 128M;

      location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
          internal;
          alias /;
          try_files $uri $uri/;
      }

      ssl_certificate /Users/danlee/.valet/Certificates/armstrong.test.crt;
      ssl_certificate_key /Users/danlee/.valet/Certificates/armstrong.test.key;

      location / {
          rewrite ^ /Users/danlee/.composer/vendor/laravel/valet/server.php last;
      }

      access_log off;
      error_log /Users/danlee/.valet/Log/nginx-error.log;

      error_page 404 /Users/danlee/.composer/vendor/laravel/valet/server.php;

      location ~ \.php$ {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass unix:/Users/danlee/.valet/valet.sock;
          fastcgi_index /Users/danlee/.composer/vendor/laravel/valet/server.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME /Users/danlee/.composer/vendor/laravel/valet/server.php;
      }

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

我的代客Nginx配置文件(尝试的修正无效)

    server {
        listen 80;
        server_name armstrong.test www.armstrong.test *.armstrong.test;
        return 301 https://$host$request_uri;
    }

    server {
        listen 443 ssl http2;
        server_name armstrong.test www.armstrong.test *.armstrong.test;
        root /;
        charset utf-8;
        client_max_body_size 128M;

        location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
            internal;
            alias /;
            try_files $uri @runway;
        }

        ssl_certificate /Users/danlee/.valet/Certificates/armstrong.test.crt;
        ssl_certificate_key /Users/danlee/.valet/Certificates/armstrong.test.key;

        # Match any other request
           location / {
               try_files $uri $uri/ @runway;
           }

           # Perch Runway
           location @runway {
               rewrite ^ /perch/core/runway/start.php last;
           }

        location / {
            rewrite ^ /Users/danlee/.composer/vendor/laravel/valet/server.php last;
        }

        access_log off;
        error_log /Users/danlee/.valet/Log/nginx-error.log;

        error_page 404 /Users/danlee/.composer/vendor/laravel/valet/server.php;

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/Users/danlee/.valet/valet.sock;
            fastcgi_index /Users/danlee/.composer/vendor/laravel/valet/server.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /Users/danlee/.composer/vendor/laravel/valet/server.php;
        }

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

0 个答案:

没有答案