- nginx目录下创建 test/www
mkdir -p test/www
-
在www目录下编写欢迎页面
vim index.html
from 8000
-
修改 conf/nginx.conf, 在http块里面添加一个server块。
server { listen 8000; server_name localhost; location / { root test/www; index index.html; } }
监听本机8000端口的请求,, root指定web服务器的根目录,这里是相对路径,也可以设置为绝对路径/usr/local/apps/nginx/test/www ,, index表示欢迎页面
-
重载nginx配置文件
-
访问 localhost:8000
, 其它机器想访问需要修改iptables的8000端口再访问。