我正在尝试在 Ubuntu 18.04 LTS 服务器上安装 Oxidized。我使用 Nginx 作为 wab 服务器,现在,系统提示我必须修改文件“/etc/nginx/nginx.conf”,我按照软件 github 页面上提供的文档正确操作。但是,当我想运行命令时,sudo nginx -t
服务器会引发此问题:
nginx: [emerg] "user" directive is not allowed here in /etc/nginx/sites-enabled/nginx.conf:1
所以我已经尝试过,sudo chown -R /etc/nginx/sites-enabled
希望这能有所改变。这是我的 nginx.conf:
user oxidized oxidized;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
log_format main '$remote_addr - $remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
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/ja$
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 80;
server_name oxidized.test.com www.oxidized.test.com;
return 301 https://$server_name$request_uri;
root /usr/share/nginx/html;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://127.0.0.1:8888/;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
我不认为我犯了什么错误,但如果有人能帮我找到问题所在就太好了。请尽快回复我。