我有2个laravel项目,一个在/ var / www / markman,另一个在/ var / www / larapp,我设法让它们一次工作一个(在“/”上),但不能在一起工作(让我们说,一个在“/”上,另一个在“/ markman”上。我安装了phpmyadmin并设法让它在/ phpmyadmin上正常工作。 nginx配置的内容:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/larapp/public;
server_name 140.82.55.247;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /markman {
root /var/www/markman/public;
rewrite ^/markman/(.*)$ /var/www/markman/public/index.php?$1 last;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location /phpmyadmin {
root /usr/share/;
index index.php;
try_files $uri $uri/ =404;
location ~ ^/phpmyadmin/(doc|sql|setup)/ {
deny all;
}
location ~ /phpmyadmin/(.+\.php)$ {
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
}
}
任何建议都非常感谢!
答案 0 :(得分:0)
你应该看看Homestead:https://laravel.com/docs/5.6/homestead
它附带了nginx,php7和mysql。
我用它在一个地方管理我的所有项目。设置起来非常简单(我在MacBook上进行设置),因为它使用VirtualBox https://www.virtualbox.org/wiki/Downloads等虚拟环境
我的Homestead.yaml
配置文件看起来像这样
---
ip: "192.168.10.10"
memory: 4096
cpus: 4
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Development
to: /var/www
sites:
- map: project-one.local
to: /var/www/Project-One/public
- map: project-two.local
to: /var/www/Project-Two/public
databases:
- project_one_db
- project_two_db