0
点赞
收藏
分享

微信扫一扫

Nginx基础篇(7)虚拟主机配置文件default.conf

minute_5 2022-06-04 阅读 84
vim /etc/nginx/conf.d/default.conf 

Nginx基础篇(7)虚拟主机配置文件default.conf _linux

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

Nginx基础篇(7)虚拟主机配置文件default.conf _nginx_02


举报

相关推荐

0 条评论