1. 服務(wù)器準(zhǔn)備
準(zhǔn)備一臺(tái)有外網(wǎng)ip的服務(wù)器, 假設(shè)IP地址為12.23.34.45, 安裝lamp或者lnmp,
安裝laravel, 配置端口為80, 因?yàn)槲⑿殴娞?hào)服務(wù)器配置地址只支持80和443
訪問(wèn)12.23.34.45, 出現(xiàn)laravel歡迎頁(yè)面 為成功
(----相信大家都會(huì), 不會(huì)的話, 參照環(huán)境搭建)

image.png
2. 環(huán)境搭建
laravel安裝https://laravelacademy.org/post/7620.html
我安裝的版本是5.5.28在apache或者nginx配置中中配置 weixin/public目錄
nginx配置如下:
server {
listen 80;
server_name localhost;
#將weixin/public加入到配置文件中
root /home/web/www/weixin/public;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#重要
try_files $uri $uri/ /index.php?$query_string;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}
重新加載nginx配置文件./sbin/nginx -s reload
訪問(wèn) 12.23.34.45, 顯示歡迎頁(yè)面