vim /etc/nginx/conf.d/default.conf
server {:默认网站配置文件
listen 80:监听端口
server_name localhost:FQDN
#charset koi8-r:网页字符类型
#access_log /var/log/nginx/host.access.log main:日志
location / {
root /usr/share/nginx/html:主目录
index index.html index.htm:默认主页名
}
新建虚拟主机
vim /etc/nginx/conf.d/http.conf
server {
listen 80;
server_name http;
location / {
root /http;
index index.html;
}
}
- server 虚拟主机
- listen 监听端口
- server_name 服务器名称
- location 网站目录设置
- root 网站主目录在本地的路径
- index 主页文件名
mkdir /http
echo 测试页面 > /http/index.html
vim /etc/hosts
192.168.19.100 http.com
systemctl restart nginx
elinks http.com