English 中文(简体)
NGinx Default public www place?
原标题:NGinx Default public www location?
  • 时间:2012-05-20 15:46:49
  •  标签:
  • nginx

I have worked with Apache before, so I am aware that the default public web root is typically /var/www/.

我最近开始与原教旨合作,但我似乎无法找到缺省公共网根。

在什么地方,我可以找到虚构的公共网络根基?

最佳回答

如果您的配置不包括<条码>/日码/月/日;说明,或包含使用诸如<条码>等相对途径的说明/编号;,则由此产生的道路取决于汇编时间的选择。

或许,如果你downloaded,并汇编了来文方。 在这种情形下,这些途径与使用<代码>-prefix的相对。 如果您不作改动,则该编码为<代码>/usr/ local/nginx。 您可以通过<代码>nginx-V汇编这些参数。

Since the root directive defaults to html, this would, of course, result in /usr/local/nginx/html being the answer to your question.

然而,如果你以任何其他方式安装了gin子,则所有 be都是在外。 你的分布可能会使用完全不同的缺省道路。 了解你如何分配选择用途,是另一个完全的任务。

问题回答

如在乌兰巴托安装,使用吸收植被,可尝试/usr/comm/nginx/www

<>光线>

On more recent versions the path has changed to: /usr/share/nginx/html

<>2019 EDIT:

Might Trial in /var/www/html/index.nginx-debian.html.

Debian的违约Nginx目录为/var/www/nginx-default

查阅文件:/etc/nginx/sites-enabled/default

发现

server {
        listen   80 default;
        server_name  localhost;

        access_log  /var/log/nginx/localhost.access.log;

        location / {
                root   /var/www/nginx-default;
                index  index.html index.htm;
        }

根源在于违约地点。

缺省公共网络根基可以从原产地-V产出中找到:

nginx -V
nginx version: nginx/1.10.1
built with OpenSSL 1.0.2h  3 May 2016
TLS SNI support enabled
configure arguments: --prefix=/var/lib/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/run/nginx/nginx.pid --lock-path=/run/nginx/nginx.lock --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --user=nginx --group=nginx --with-ipv6 --with-file-aio --with-pcre-jit --with-http_dav_module --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_v2_module --with-http_auth_request_module --with-mail --with-mail_ssl_module

the --prefix value is the answer to the question. for the sample above the root is /var/lib/nginx

乌班图和码头图像:

 /usr/share/nginx/html/

关于麦克雷 X 安装有rew子的gin子,使缺损目录:

/usr/local/var/www

因此:

root html

手段

root /usr/local/var/www/html

没有任何html的名录,因此必须手工制作。

正如这里的大多数用户所说的那样,它正在这条道路上:

/usr/share/nginx/html

这是一条不停的道路,但你可以做到。

你们都需要在网络服务器根树上打一个树,给它一些“而不是777”的许可,只允许一个用户,只让一个用户看上去,但是,由于道路的结束,你的文件和文件将被公众看到。

例如,你可以这样作:

home_web/site1/public_html/www/

每当你在Nginx成为虚拟东道国时,你就能够定制自己的根本道路,在你的服务器栏中添加类似内容:

 server {
    listen  80;
        server_name  yoursite.com;

root /home_web/site1/public_html/www/;
}

页: 1 网址根切:

nano /etc/nginx/sites-enabled/default

在<>dstrong>default文档中,在服务器标签上查阅root,并更换网站的缺省夹,例如,我的网址是/var/www

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www; <-- Here!
...

When I was evaluating nginx, apache2 and lighttpd, I mapped all of them to my website sitting at /var/www. I found this the best way to evaluate efficiently.

然后,你可以开始/穿过你所选择的服务器,看看哪一个是最佳的。

e.g.

service apache2 stop
service nginx start

Btw, 根基实际上非常快!

Look into nginx config file to be sure. This command greps for whatever is configured on your Machine:

cat /etc/nginx/sites-enabled/default |grep "root"

在我的机器上是:root /usr/comm/nginx/www;

根基X的缺电网夹取决于你是如何安装的,但通常位于这些地点:

/usr/local/nginx/html
/usr/nginx/html

指令nginx -V,并查询-prefix。 利用这一条目确定你的违约道路。

在Mac 安装有制鞋的 n:

/usr/ local/etc/nginx/nginx.conf

location / { 
    root   html;  # **means /usr/local/Cellar/nginx/1.8.0/html and it soft linked to /usr/local/var/www**
    index  index.html;
}  

对于CentOS、Utub和Fedora,缺省名录为/usr/comm/nginx/html

For AWS EC2 页: 1

/usr/share/nginx

在我的案件中,见/usr/comm/nginx/html>。

您可以尝试进行搜查。

find / -name html

仅指出,原始服务器的违约指数页也将显示根基。 从亚马孙湖农庄 n(1.4.3)到:

这是一种缺省指数.html页,在亚马孙湖工业部长会议上用原子分发。 它位于/usr/comm/nginx/html。

你们现在应当把你们的内容放在你们选择的某个地点,并将根基配置指令植根于根基配置文件/etc/nginx/nginx。

如果你在乌班图14.04上,你可以找到 n子:www.archy。

yusuf@yusuf-he:/usr/share/nginx/html$ pwd
/usr/share/nginx/html
yusuf@yusuf-he:/usr/share/nginx/html$

无论在什么地方,你都可以寻找这个系统(系统管理或新版的gin)。

find / -name nginx

*default pages web allocated in var/www/html *default configuration server etc/nginx/sites/avaliable/nginx.conf

server {

    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html index.php;

    server_name _;

    location /data/ {
        autoindex on;
    }

    location /Maxtor {
        root /media/odroid/;
        autoindex on;

    }

        # This option is important for using PHP.
    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }
}

<*default configuracion services等/nginx/nginx.conf>

content..

user www-data;
worker_processes 8;
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; # 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;
#   }
#}

<default accesslog with theipuser var/log/nginx/...

you can access file config nginx,you can see root /path. in this default of nginx apache at /var/www/html

My nginx on Ubuntu is "nginx version: nginx/1.9.12 (Ubuntu)" and root path is /var/www/html/

Ubuntu info is : No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04 LTS Release: 16.04 Codename: xenial

实际上,如果你刚刚在乌兰巴托安装了正文,那么你可以去“/etc/nginx/sites- available”并核对缺省档案,就有一个配置,如“root /web/root/path/goes/here”。 这正是你所期待的。

In Ubuntu, Nginx default root Directory location is /usr/share/nginx/html

You can find it in /var/www/ that is default directory for nginx and apache but you can change it. step 1 go to the following folder /etc/nginx/sites-available

第2步的违约卷宗是,你可以找到一个服务器组,因为有一条线被称作是确定地点的根本。

in ubuntu 19.04, we found it on

/usr/comm/nginx/html

www.un.org/spanish/ecosoc nginx/1.4.6(Ubuntu)

/etc/nginx$ cat /etc/nginx/sites-available/default | grep -i root
- root /usr/share/nginx/html;

我在“数字海洋”上也曾有过这个议题,它有一个有gin的言语网站。

My solution was to do the following:

  1. Modify the /etc/nginx/nginx.conf file with the following:
server {
root /var/www/html;
}

然后,我不得不打上<条码>。

http://www.un.org -V的指挥还显示贵方根基X config文档的位置(在/etc/nginx/nginx.conf上标明)

The default is related to the prefix option of the configure script when nginx is compiled; here s some strange sample from Debian:

% nginx -V | & tr     "
" | fgrep -e path -e prefix
--prefix=/etc/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-log-path=/var/log/nginx/access.log
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--lock-path=/var/lock/nginx.lock
--pid-path=/var/run/nginx.pid

随后,root,。 (根据http://nginx.org/r/root” rel=“nofollow noreferer”>,root Directive, 可在prefix内查阅,可在 编码<_document_root/code>上查到>。 简编文件变量:

# printf  server{listen 4867;return 200 $document_root\n;}
  
    >/etc/nginx/conf.d/so.10674867.conf

# nginx -s reload && curl localhost:4867
/etc/nginx/html

然而,象德比亚这样的邪恶分布似乎在改观,使你感到不快:

% fgrep -e root -e include /etc/nginx/nginx.conf
    include /etc/nginx/mime.types;
    #include /etc/nginx/naxsi_core.rules;
    #passenger_root /usr;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

% fgrep -e root -e include 
    /etc/nginx/conf.d/*.conf /etc/nginx/sites-enabled/*
/etc/nginx/conf.d/so.10674867.conf:server{listen 4867;return 200 $document_root
;}
/etc/nginx/sites-enabled/default:   root /usr/share/nginx/www;
/etc/nginx/sites-enabled/default:       # include /etc/nginx/naxsi.rules
/etc/nginx/sites-enabled/default:   #   root /usr/share/nginx/www;
/etc/nginx/sites-enabled/default:   #   include fastcgi_params;
/etc/nginx/sites-enabled/default:   # deny access to .htaccess files, if Apache s document root
/etc/nginx/sites-enabled/default:#  root html;
/etc/nginx/sites-enabled/default:#  root html;

因此,就Debian一案而言,你可以看到,最终将根基定在<代码>/usr/comm/nginx/www上。

但是,正如你看到的,将使用其<代码>的文件_root的抽样服务器配置。 http://www.un.org/french/ga/president

甲型六氯环己烷根本没有任何违约地点。 The file /etc/nginx/conf.d/default.conf 说:

# Everything is a 404
location / {
    return 404;
}

# You may need this to prevent return 404 recursion.
location = /404.html {
    internal;
}

用<代码>root /var/www/ localhost/htdocs等行文取代。 接着,<代码>sudo Service nginxstart 重新启用。





相关问题
nginx behaved differently for different version

I have used docker image nginx:1.18.0-alpine previously and below is the conf. It works as expected app.localhost --> points to the block wit server_name app.* localhost --> points to the other ...

What s limiting my PHP resources?

I m having a problem getting more memory out of PHP. This is the error message: Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 82 bytes) in ... Yet: I ve set ...

what user I should run my nginx or php-fpm processes

Ok. Im little bit confused about those permissions in linux so please people help me out. The trouble is that I dont want to run server as root, so I created another user with sudo privileges so he ...

Nginx 301 redirect inc. set cookie

what I m looking for is the ability for nginx to detect that a url has the query string variable cid. for example www.adomain.com/froggy?cid=12&as=false (query string can be solo or mixed with ...

Nginx raises 404 when using format => js

I upload images to my App using Ajax and an Iframe. In Development everything works like a charm. But in production Nginx suddenly raises a 404 error. When I look into the log, the request never hits ...

nginx errors readv() and recv() failed

I use nginx along with fastcgi. I see a lot of the following errors in the error logs readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

热门标签