Skip to content

debug page production / 如何生产环境下调试页面  #14

Open
@JiangWeixian

Description

有时你需要模拟真实环境才能够进行调试。特别是对于hybrid页面,以及客户端可能或许对ip页面进行限制。以至于你不得不通过真实的的路由地址访问开发环境。

工具

  1. switchhost
  2. nginx
  3. charles

Steps in macos

  1. brew install nginx

  2. config nginx in /usr/local/etc/nginx/nginx.config

    server {
        listen       80;
        server_name  线上地址;
    
        #charset koi8-r;
    
        #access_log  logs/host.access.log  main;
    
        #error_page  404              /404.html;
    
        # redirect server error pages to the static page /50x.html
        #
    
        location / {
            proxy_pass http://127.0.0.1:3000;
        }
    
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
    
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    
    
  3. 使用swtichhosts

    image

  4. charles(optional)
    设置代理服务器主机名(ip), 设置服务器端口(8888)

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions