I follow the guide of Nginx on ArchWiki add two dir called sites-available and sites-enabled. Then I create /etc/nginx/sites-available/www.conf and link it to sites-enabled
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name malacology.net;
ssl_certificate /etc/nginx/web_ssl/www/1_www.malacology.net_bundle.crt;
ssl_certificate_key /etc/nginx/web_ssl/www/2_www.malacology.net.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://120.xx.xxx.xx;
proxy_read_timeout 90;
proxy_redirect http://120.xx.xxx.xx https://malacology.net;
}
}
But it fails.
[root@archlinux sites-available]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
[root@archlinux sites-available]# nginx -t
2021/07/06 20:04:59 [emerg] 1023285#1023285: open() "/etc/nginx/sites-enabled/www.conf" failed (40: Too many levels of symbolic links) in /etc/nginx/nginx.conf:19
nginx: configuration file /etc/nginx/nginx.conf test failed
When I use my Ubuntu that’s okay, but now it doesn’t work.
Then other output
[root@archlinux ~]# cat /etc/nginx/nginx.conf
user root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
include sites-enabled/*;
default_type application/octet-stream;
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
[root@archlinux ~]# ls -l /etc/nginx/sites-enabled
total 0
lrwxrwxrwx 1 root root 35 Jul 6 21:38 www.conf -> /etc/nginx/sites-available/www.conf
[root@archlinux ~]# ls -l /etc/nginx/sites-available
total 4
-rw-r--r-- 1 root root 900 Jul 6 20:11 www.conf
same issue https://bbs.archlinux.org/viewtopic.php?id=267765