怎么在 localhost 下访问多个 Laravel 项目,通过一个IP访问多个项目(不仅仅是改变端口哦)


server { listen 80; server_name blog.sweetsunnyflower.com; index index.html index.htm index.php; charset utf-8; # 项目1 location ^~ /project1/ { alias /var/www/project1/public/; try_files $uri $uri/ @project1; location ~ \.php$ { fastcgi_pass unix:/run/php/php7.1-fpm.sock; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $request_filename; include fastcgi_params; } } location @project1 { rewrite /project1/(.*)$ /project1/index.php?/$1 last; } # 项目2 location ^~ /project2/ { alias /var/www/project2/public/; try_files $uri $uri/ @project2; location ~ \.php$ { fastcgi_pass unix:/run/php/php7.1-fpm.sock; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $request_filename; include fastcgi_params; } } location @project2 { rewrite /project2/(.*)$ /project2/index.php?/$1 last; } access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log error; sendfile off; }

  

posted @ 2019-10-08 15:29  花泪哲  阅读(669)  评论(0编辑  收藏  举报