V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
sutking
V2EX  ›  NGINX

我的 nginx conf 文件好像少了很多内容啊,怎么办?

  •  
  •   sutking · 2014-11-07 21:55:02 +08:00 · 3107 次点击
    这是一个创建于 3459 天前的主题,其中的信息可能已经有所发展或是发生改变。
    文件全部内容是这样的:
    没有server部分,也没有定义php.html.htm的index格式文件的先后顺序部分,手动添加可以吗?添加到那个位置?具体内容是什么?如果不能添加是不是我少安装了什么?

    ser www-data;
    worker_processes 4;
    pid /var/run/nginx.pid;
    events {
    worker_connections 768;
    # multi_accept on;
    }
    http {
    ##
    # Basic Settings
    ##
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    ##
    # Logging Settings
    ##
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    ##
    # Gzip Settings
    ##
    gzip on;
    gzip_disable "msie6";
    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml appl$
    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##
    #include /etc/nginx/naxsi_core.rules;
    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##
    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;
    ##
    # Virtual Host Configs
    ##
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    }
    #mail {
    # # See sample authentication script at:
    # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
    #
    # # auth_http localhost/auth.php;
    # # pop3_capabilities "TOP" "USER";
    # # imap_capabilities "IMAP4rev1" "UIDPLUS";
    #
    # server {
    # listen localhost:110;
    # protocol pop3;
    # proxy on;
    # }
    #
    #
    # server {
    # listen localhost:143;
    # protocol imap;
    # proxy on;
    # }
    #}
    8 条回复    2014-11-11 20:39:35 +08:00
    sunshower
        1
    sunshower  
       2014-11-07 22:06:50 +08:00
    官网下个包,打开复制一份conf很难么?
    wzxjohn
        2
    wzxjohn  
       2014-11-07 22:17:09 +08:00 via iPhone
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    你看到这两条了么。。。
    @sunshower 某些发行版默认的配置确实就是这样的。
    sutking
        3
    sutking  
    OP
       2014-11-08 08:46:59 +08:00 via iPhone
    @wzxjohn 怎么讲?可以说的详细点吗?
    ryd994
        4
    ryd994  
       2014-11-09 03:26:25 +08:00 via Android
    @sutking 就是不要改这个文件
    server块写到sites-enabled文件夹里建一个文件
    sutking
        5
    sutking  
    OP
       2014-11-11 09:08:59 +08:00 via iPhone
    @ryd994 都需要自己手动操作完成吗?有没有现成的文件?我怕我写不完整…
    ryd994
        6
    ryd994  
       2014-11-11 09:16:32 +08:00 via Android
    @sutking 大多数自带default,可以参考。
    另外Nginx默认配置很好,基本可以不用多改。静态就看http_core模块,动态就看fcgi部分,其他的看过知道什么时候用就行
    http://nginx.org/en/docs/
    sutking
        7
    sutking  
    OP
       2014-11-11 19:07:25 +08:00
    @ryd994 我想设置网站默认先打开index.php页面,可是sites-enabled文件夹里的配置文件重启服务器还是没有变化啊……
    sutking
        8
    sutking  
    OP
       2014-11-11 20:39:35 +08:00
    我把index.html删掉了,就好了……
    真奇怪的问题啊……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2518 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:03 · PVG 08:03 · LAX 17:03 · JFK 20:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.