Nginx + Symfony 4 + Subfolder =问题

时间:2018-06-19 10:59:31

标签: symfony nginx networking debian fpm

我的nginx和Symfony有问题

我有一个symfony应用程序,它可以在我按照文档时工作,但我想做这样的事情 http://website.com/symfonyapp1http://website.com/symfonyapp2

这是我的nginx配置:

server {


server_name website.com;

   location /symfonyapp1{
      root /var/www/html/symfonyapp1/public;
      # try to serve file directly, fallback to index.php
      try_files $uri symfonyapp1 /index.php$is_args$args;

   }
   location ~ ^/symfonyapp1/public/index\.php(/|$) {
       fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
       fastcgi_split_path_info ^(.+\.php)(/.*)$;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
       fastcgi_param DOCUMENT_ROOT $realpath_root;
       internal;
   }
}

这是我的/ etc / hosts文件

XXX.XXX.XX.XX   website1.local  symfonyapp1
XXX.XXX.XX.XX   website2.local  symfonyapp2

如果有人可以帮助我,那将非常有帮助

提前致谢

0 个答案:

没有答案