我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
当前回答
你可以搜索它,不管他们把它移动到哪里(系统管理移动或更新版本的nginx)
找到/ -name nginx
其他回答
你可以在nginx和apache的默认目录/var/www/中找到它,但你可以改变它。 步骤1进入“/etc/nginx/sites-available”文件夹
步骤2编辑默认文件,您可以在其中找到一个服务器块,其中将有命名为root的行,这是定义位置的内容。
*默认页面web分配在var/www/html *默认配置服务器etc/nginx/sites/ available /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;
}
}
*默认配置服务器etc/nginx/nginx.conf
内容. .
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;
# }
#}
IP客户端的默认访问日志var/log/nginx/…
你可以搜索它,不管他们把它移动到哪里(系统管理移动或更新版本的nginx)
找到/ -name nginx
需要注意的是,nginx服务器的默认索引页面也会显示根位置。从Amazon Linux AMI上的nginx(1.4.3),您可以得到以下内容:
这是默认的index.html页面,在Amazon Linux AMI上与nginx一起分发。它位于/usr/share/nginx/html。
你现在应该把你的内容放在你选择的位置,并编辑nginx配置文件/etc/nginx/nginx.conf中的根配置指令
我在Ubuntu上的nginx是“nginx version: nginx/1.9.12 (Ubuntu)” 根路径为/var/www/html/
Ubuntu信息是: 没有LSB模块可用。 分销商ID: Ubuntu 描述:Ubuntu 16.04 LTS 版本:16.04 代号:主客关系的
实际上,如果你只是在Ubuntu上安装了nginx,那么你可以去“/etc/nginx/sites-available”并检查默认文件,有一个类似于“root/ web/root/path/goes/here”的配置。这就是你要找的。