修改本地host文件池颈,映射到域名
C:\Windows\System32\drivers\etc
添加
127.0.0.1 weixinkaifa.com
Nginx 做代理录淡,把80端口轉(zhuǎn)發(fā)到您本地應(yīng)用地址
#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;
#關(guān)鍵設(shè)置:將80端口轉(zhuǎn)發(fā)到 8099 端口 ,下面是你項(xiàng)目的開發(fā)環(huán)境訪問地址?铩O馗ぁC拼祖搓!
proxy_pass http://127.0.0.1:8089;
}
}
}
通過域名訪問項(xiàng)目
啟動(dòng)項(xiàng)目狱意,訪問:
http://www.weixinkaifa.com/
此時(shí),訪問通過代理 訪問順序
http://www.weixinkaifa.com > 120.0.0.1:8099
微信官網(wǎng)注冊(cè)測(cè)試好
添加自己的域名
圖片.png