买了一台服务器
不干别的,就放几个静态网页
分别在
/www/wwwroot/a
/www/wwwroot/b
/www/wwwroot/c
后面就是html和资源文件了
手里恰好也有几个闲置域名
需要配置这几个直接访问
我们假设域名的dns都配置好了
仅谈nginx配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| http {
server { listen 80; server_name a.com; include enable-php.conf;
location / { root /www/wwwroot/a; index index.php index.html index.htm default.php default.htm default.html; try_files $uri $uri/ /index.html; } location /api/config { proxy_pass http://127.0.0.1:3001; proxy_set_header HOST $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Request-Url $request_uri; } access_log /www/wwwlogs/access.log; }
server { listen 80; server_name b.net; include enable-php.conf; location / { root /www/wwwroot/b; index index.php index.html index.htm default.php default.htm default.html; try_files $uri $uri/ /index.html; } access_log /www/wwwlogs/access.log; } include /www/server/panel/vhost/nginx/*.conf; }
|
这样
a.com访问/www/wwwroot/a/index.html
b.net访问 /www/wwwroot/b/index.html