这时候,我们从后台可以看到nginx做事已经启动了,但是访问网站便是无法显示测试网页index.html的信息,返回页面仍旧是nginx的测试页面,到底是怎么回事呢?
[root@hamster1 ~]# ps -ef | grep nginxroot 6310 5816 0 20:45 pts/0 00:00:00 grep --color=auto nginxroot 20882 1 0 12月18 ? 00:00:00 nginx: master process nginxnginx 21094 20882 0 12月18 ? 00:00:00 nginx: worker process
实在很大略,我们只须要在配置文件中注释下面这一行,并重启nginx做事即可:
#include /etc/nginx/conf.d/.conf;
全部的配置文件如下:
nginx version: nginx/1.20.2user nginx;worker_processes auto;error_log /var/log/nginx/error.log notice;pid /var/run/nginx.pid;events { worker_connections 1024;}http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; #include /etc/nginx/conf.d/.conf; server { listen 80; server_name xxxx.com; location / { root /data/www; index index.html; } }}