修改本地host文件,映射到域名
C:\Windows\System32\drivers\etc
添加
127.0.0.1 weixinkaifa.com
Nginx 做代理,把80端口轉發到您本地應用地址
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
#關鍵設置:將80端口轉發到 8099 端口 ,下面是你項目的開發環境訪問地址!?。?!
proxy_pass http://127.0.0.1:8089;
}
}
}
通過域名訪問項目
啟動項目,訪問:
http://www.weixinkaifa.com/
此時,訪問通過代理 訪問順序
http://www.weixinkaifa.com > 120.0.0.1:8099
微信官網注冊測試好
添加自己的域名
圖片.png