centos下nginx访问80端口一直为默认的欢迎页面。

ohmybbq 2020-04-16 04:04:50
如题。
系统为Centos,nginx安装目录在/usr/local/nginx下。
首先配置文件nginx.conf应该是正确的,我改为非80端口项目时可正常访问,但如果是80端口出现的还是nginx的默认欢迎页面,并且使用nginx -t命令进行检测时也不报错,直接运行nginx命令也能正常启动。
在网上搜了好多资料,都是千篇一律,说的最多的是修改/etc/nginx/sites-enabled/mysite.conf文件,但是我这上面根本就没这文件,目录都没有,我是安装在/usr/local/nginx下的。

哪些大神指点一下,我都断断续续搞了半个月了,郁闷死了。
噢,还是我的是阿里云服务器centos
...全文
2266 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
第三枚小菜鸟 2021-10-15
  • 打赏
  • 举报
回复

我也遇到了相似的问题。最后排查发现改错了nginx.conf文件。
我的nginx安装包下载到/usr/local/src下 ,在执行make和make install后。真实的安装目录位于/usr/local/webserver/nginx,当修改了这个目录下的conf时,就没问题了。可以通过nginx -t查看到conf文件所在的位置

奋斗的新丁 2021-01-07
  • 打赏
  • 举报
回复
我也遇到和楼主一样的问题了,请问楼主解决了吗
ohmybbq 2020-04-20
  • 打赏
  • 举报
回复
server { #listen 80; #server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root html; #} # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } 居然这样注释不行,要彻底删除。搞了好久哦。。。
青鬆下的坚躯 2020-04-17
  • 打赏
  • 举报
回复
确认下你的配置文件如下三项是否是你的期望值。重启生效。

//NGINX_PATH/conf.d/default.conf 
server {
    listen       80;
    server_name  localhost;
    ....
    location / {
        root   /vagrant;
       ...
    }
}
jio可 2020-04-17
  • 打赏
  • 举报
回复
nginx.conf.default 里面配置80端口
ohmybbq 2020-04-17
  • 打赏
  • 举报
回复
顶顶顶顶顶。
jio可 2020-04-16
  • 打赏
  • 举报
回复
用Homebrew装试试

5,658

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧