美文网首页
微信小程序PHP服务端Nginx配置

微信小程序PHP服务端Nginx配置

作者: tt大眼仔 | 来源:发表于2018-12-11 10:28 被阅读30次

    下面的/var/www/dbmz/server为小程序的PHP服务端目录
    需要添加一个/weapp/的路由映射到小程序的server根目录

    server {
      listen       80;
      server_name  a.com;
      root         /var/www/dbmz/server;
      index        index.php index.html;
      location / {
        try_files $uri $uri/ =404;
      }
      
      location ~* \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
      }
    
      location /weapp/ {
        root   /var/www/dbmz/server;
        index  index.html index.htm index.php;
        try_files $uri $uri/ /index.php;
      }
    
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/a.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/a.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    }
    

    相关文章

      网友评论

          本文标题:微信小程序PHP服务端Nginx配置

          本文链接:https://www.haomeiwen.com/subject/uikshqtx.html