跳到主要内容

本地调试

2024年04月27日
柏拉文
越努力,越幸运

一、认识


二、配置


2.1 Nginx

user root admin;
worker_processes 1;

events {
worker_connections 1024;
}

http {
sendfile on;
include mime.types;
keepalive_timeout 65;
access_log logs/access.log;
error_log logs/error.log info;
default_type application/octet-stream;

server {
listen 80;
server_name localhost;

location / {
root /Users/zhangwenqiang/bolawen/;
index index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

server {
listen 80;
server_name test.bolawen.com;
location / {
root /Users/zhangwenqiang/bolawen/;
index index.html index.htm;
}
location /server {
rewrite ^/server/(.*) /$1 break;
proxy_pass http://localhost:4000;
}
}


include servers/*;
}

2.2 SwitchHost

SwitchHosttest.bolawen.com 一级域名、二级域名映射到 127.0.0.1

127.0.0.1 test.bolawen.com
127.0.0.1 test.a.bolawen.com
127.0.0.1 test.b.bolawen.com