Open
Description
有时你需要模拟真实环境才能够进行调试。特别是对于
hybrid
页面,以及客户端可能或许对ip
页面进行限制。以至于你不得不通过真实的的路由地址访问开发环境。
工具
- switchhost
- nginx
- charles
Steps in macos
-
brew install nginx
-
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; #} }
-
charles(optional)
设置代理服务器主机名(ip), 设置服务器端口(8888)