PHP实现微信扫码登陆(二)--服务器环境准备

其实我很douIP属地: 北京
字数 175

1. 服务器准备

准备一台有外网ip的服务器, 假设IP地址为12.23.34.45, 安装lamp或者lnmp,
安装laravel, 配置端口为80, 因为微信公众号服务器配置地址只支持80和443
访问12.23.34.45, 出现laravel欢迎页面 为成功
(----相信大家都会, 不会的话, 参照环境搭建)


image.png

2. 环境搭建

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
访问 12.23.34.45, 显示欢迎页面

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
0人点赞
总资产102共写了4.3W字获得109个赞共48个粉丝

推荐阅读更多精彩内容