免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2724 | 回复: 1
打印 上一主题 下一主题

nginx 安装完默认显示404页面 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-02-26 19:33 |只看该作者 |倒序浏览
centos 6.2 AMD 64 位
源码装有一堆错误,索性先yum安装
  1. [root@hdictest02 html]# nginx -V
  2. nginx version: nginx/1.0.12
  3. built by gcc 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)
  4. TLS SNI support enabled
  5. configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g'
复制代码
  1. [root@hdictest02 html]# rpm -ql nginx
  2. /etc/logrotate.d/nginx
  3. /etc/nginx
  4. /etc/nginx/conf.d
  5. /etc/nginx/conf.d/default.conf
  6. /etc/nginx/conf.d/example_ssl.conf
  7. /etc/nginx/fastcgi_params
  8. /etc/nginx/koi-utf
  9. /etc/nginx/koi-win
  10. /etc/nginx/mime.types
  11. /etc/nginx/nginx.conf
  12. /etc/nginx/scgi_params
  13. /etc/nginx/uwsgi_params
  14. /etc/nginx/win-utf
  15. /etc/rc.d/init.d/nginx
  16. /etc/sysconfig/nginx
  17. /usr/sbin/nginx
  18. /usr/share/nginx
  19. /usr/share/nginx/html
  20. /usr/share/nginx/html/50x.html
  21. /usr/share/nginx/html/index.html
  22. /var/cache/nginx
  23. /var/log/nginx
复制代码

  1. user  nginx nginx;
  2. worker_processes  4444;

  3. #error_log  logs/error.log;
  4. #error_log  logs/error.log  notice;
  5. #error_log  logs/error.log  info;

  6. #pid        logs/nginx.pid;


  7. events {
  8.         use     epoll;
  9.     worker_connections  1024;
  10. }


  11. http {
  12.     include       mime.types;
  13.     default_type  application/octet-stream;

  14.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  15.     #                  '$status $body_bytes_sent "$http_referer" '
  16.     #                  '"$http_user_agent" "$http_x_forwarded_for"';

  17.     #access_log  logs/access.log  main;

  18.     sendfile        on;
  19.     #tcp_nopush     on;

  20.     #keepalive_timeout  0;
  21.     keepalive_timeout  65;

  22.     #gzip  on;

  23.     server {
  24.         listen       80;
  25.         server_name  localhost;

  26.         #charset koi8-r;

  27.         #access_log  logs/host.access.log  main;

  28.         location / {
  29.             root   html;
  30.             index  index.html index.htm;
  31.         }

  32.         #error_page  404              /404.html;

  33.         # redirect server error pages to the static page /50x.html
  34. #
  35.         error_page   500 502 503 504  /50x.html;
  36.         location = /50x.html {
  37.             root   html;
  38.         }

  39.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  40.         #
  41.         #location ~ \.php$ {
  42.         #    proxy_pass   http://127.0.0.1;
  43.         #}

  44.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  45.         #
  46.         #location ~ \.php$ {
  47.         #    root           html;
  48.         #    fastcgi_pass   127.0.0.1:9000;
  49.         #    fastcgi_index  index.php;
  50.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  51.         #    include        fastcgi_params;
  52.         #}

  53.         # deny access to .htaccess files, if Apache's document root
  54.         # concurs with nginx's one
  55.         #
  56.         #location ~ /\.ht {
  57.         #    deny  all;
  58.         #}
  59.     }


  60.     # another virtual host using mix of IP-, name-, and port-based configuration
  61.     #
  62.     #server {
  63.     #    listen       8000;
  64.     #    listen       somename:8080;
  65.     #    server_name  somename  alias  another.alias;

  66.     #    location / {
  67.     #        root   html;
  68.     #        index  index.html index.htm;
  69.     #    }
  70.     #}


  71.     # HTTPS server
  72.     #
  73.     #server {
  74.     #    listen       443;
  75.     #    server_name  localhost;
  76.    #    ssl                  on;
  77.     #    ssl_certificate      cert.pem;
  78.     #    ssl_certificate_key  cert.key;

  79.     #    ssl_session_timeout  5m;

  80.     #    ssl_protocols  SSLv2 SSLv3 TLSv1;
  81.     #    ssl_ciphers  HIGH:!aNULL:!MD5;
  82.     #    ssl_prefer_server_ciphers   on;

  83.     #    location / {
  84.     #        root   html;
  85.     #        index  index.html index.htm;
  86.     #    }
  87.     #}

  88. }
复制代码
输入地址后显示404页面,为什么没有显示welcome to nginx这个页面?
路过的朋友看下,刚接触nginx !

论坛徽章:
0
2 [报告]
发表于 2012-02-28 23:35 |只看该作者
应该是root的路径不对
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP