php项目部署lnmp,如何在lnmp环境里,部署多个php项目?
我有2個php項目,想放在同一個lnmp環境里
如果你說兩個項目是通過兩個不同的域名來訪問的話,直接參考以下conf文件內容
第一段:
server {
listen ? ? ? 80 ;
server_name ?www.host1.cc; #監聽的hostname
root ? /var/www/www_host1_cc/; #第一個項目的根目錄
location / {
root ? /var/www/www_host1_cc/;
index ?index.php index.html index.htm;
}
error_page ?404 ? ? ? ? ? ? ?/404.html;
location = /404.html {
root ? /usr/share/nginx/html;
}
error_page ? 500 502 503 504 ?/50x.html;
location = /50x.html {
root ? /usr/share/nginx/html;
}
location ~ .*\.(php|php5)?(\/.*)*$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param ?SCRIPT_FILENAME ?$document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
include ? ?fastcgi_params;
}
}
第二段:
(此處參考第一段,僅需要修改對應的server_name 和 root)
然后將域名解析到服務器的IP地址即可。
很簡單啊 。
配置nginx vhost就行了。
使用docker
總結
以上是生活随笔為你收集整理的php项目部署lnmp,如何在lnmp环境里,部署多个php项目?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 苹果usb驱动下载(苹果usb设备的驱动
- 下一篇: linux文件系统的管理方法,Linux