为什么 nginx 安装后,没有修改任何配置文件,只在/var/www/html 下新建一个文件夹和一个 html 文件,就能通过 “http://ip/文件夹” 访问了 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zxCoder
V2EX    NGINX

为什么 nginx 安装后,没有修改任何配置文件,只在/var/www/html 下新建一个文件夹和一个 html 文件,就能通过 “http://ip/文件夹” 访问了

  •  
  •   zxCoder 2021-05-11 08:56:22 +08:00 2812 次点击
    这是一个创建于 1697 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我记得以前不还得配置 server location 什么的

    配置文件我看 /etc/nginx/nginx.conf 里基本都注释了,include 的文件夹也都是空的,不知道默认配置在哪里

    然后 /usr/share/nginx/html 也有一个 index.html,这个不知道是干嘛的

    求一个 nginx 最新的配置文档,官网文档挺乱的

    Lax
        1
    Lax  
       2021-05-11 09:10:00 +08:00
    nginx -V 看看编译选项
    wclebb
        2
    wclebb  
       2021-05-11 09:12:16 +08:00
    为什么 iPhone 插了手机卡后,没有填写任何填表文件,只要在 通话 App 下拨号 13412341234 就能通过通话拨号了呢?
    yanyumihuang
        3
    yanyumihuang  
       2021-05-11 09:14:07 +08:00
    默认绑定了 80 端口,在就在 /etc/nginx/下的文件夹里,你好好找找,我记不清是哪个了
    zxCoder
        4
    zxCoder  
    OP
       2021-05-11 09:14:31 +08:00
    @Lax

    nginx version: nginx/1.18.0 (Ubuntu)
    built with OpenSSL 1.1.1f 31 Mar 2020
    TLS SNI support enabled
    configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-5J5hor/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-compat --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module


    没找着 /var/www
    zxCoder
        5
    zxCoder  
    OP
       2021-05-11 09:15:27 +08:00
    @yanyumihuang

    配置文件 nginx.conf 是这样的

    user root;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;

    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;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # 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/Javascript text/xml application/xml application/xml+rss text/Javascript;

    ##
    # 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;
    # }
    #}
    drush
        6
    drush  
       2021-05-11 09:16:19 +08:00
    /etc/nginx/sites-available/default
    titanium98118
        7
    titanium98118  
       2021-05-11 09:16:59 +08:00
    不同发行版本,打包都不一样,ubuntu 里的 nginx.conf 默认有 include 的
    lizenghui
        8
    lizenghui  
       2021-05-11 09:17:07 +08:00
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;


    这不是还有配置嘛,都是空的?
    wangsipeng95
        9
    wangsipeng95  
       2021-05-11 09:18:15 +08:00
    默认 nginx.conf 里面应该有 include /etc/nginx/conf.d/*.conf; 我记得 /etc/nginx/conf.d 里面有个 default.conf
    zxCoder
        10
    zxCoder  
    OP
       2021-05-11 09:26:33 +08:00
    @drush
    @titanium98118
    @lizenghui
    @wangsipeng95

    是在这个下面找到了 /etc/nginx/sites-enabled/*

    多谢各位
    hades97
        11
    hades97  
       2021-05-11 14:30:47 +08:00
    /etc/nginx/sites-available 这里列出你的全部网站
    /etc/nginx/sites-enabled 这里是启用你的网站,实际是建立一个 link 到 available 里面的文件
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2305 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 20ms UTC 02:11 PVG 10:11 LAX 18:11 JFK 21:11
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86