ยง2024-09-28

n2Odroid+, mail.yushei.net, ubuntu Jammy, jitsi-meet and wildduck instralled

  1. removing all sites-enabled, only /etc/nginx/nginx.conf
user www-data;
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;
	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;
#	}
#}
$ curl https://yushei.net
curl: (7) Failed to connect to yushei.net port 443 after 173 ms: Connection refused
alexlai@mail:/etc/nginx$ curl http://yushei.net
curl: (7) Failed to connect to yushei.net port 80 after 68 ms: Connection refused
alexlai@mail:/etc/nginx$ curl http://192.168.16.249
curl: (7) Failed to connect to 192.168.16.249 port 80 after 0 ms: Connection refused
alexlai@mail:/etc/nginx$ curl https://192.168.16.249/
curl: (7) Failed to connect to 192.168.16.249 port 443 after 0 ms: Connection refused

  1. edit sites-available/uptream-80, as
server {
    # listen 80 http;
    listen 80;
    server_name localhost;

    # ssl_certificate /etc/letsencrypt/live/munetaka.me/fullchain.pem;
    # ssl_certificate_key /etc/letsencrypt/live/munetaka.me/privkey.pem;

    location / {
        root /usr/share/nginx/html/;
        index index.html;
    }
}
alexlai@mail:/etc/nginx/sites-enabled$ sudo ln -sf /etc/nginx/sites-available/uptream-80  upstream-80
alexlai@mail:/etc/nginx/sites-enabled$ ls -l
total 0
lrwxrwxrwx 1 root root 37 Sep 28 09:30 upstream-80 -> /etc/nginx/sites-available/uptream-80
alexlai@mail:/etc/nginx/sites-enabled$ sudo ln -sf /etc/nginx/sites-available/uptream-80  upstream-80
alexlai@mail:/etc/nginx/sites-enabled$ ls -l
total 0
lrwxrwxrwx 1 root root 37 Sep 28 09:30 upstream-80 -> /etc/nginx/sites-available/uptream-80
alexlai@mail:/etc/nginx/sites-enabled$ sudo systemctl restart nginx
alexlai@mail:/etc/nginx/sites-enabled$ curl http://yushei.net
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
alexlai@mail:/etc/nginx/sites-enabled$ curl https://yushei.net
curl: (7) Failed to connect to yushei.net port 443 after 226 ms: Connection refused
alexlai@mail:/etc/nginx/sites-enabled$ curl http://192.168.16.249
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>