NTTU 伺服器原理 WriteUp
- Ansible
- SELinux
DNS server
Intro (2023.09.20)
SELinux review
ls -lZsemanagesetenforcechconfirewalld
名詞解釋
- DNS : Domain name service
- FQDN : Fully Qualified Domain Name
- Domain
- Subdomain
- Zone : Depand on Domain manager
client
/etc/nsswitch.conf(Name Sever Switch)/etc/hosts: Test usage , contains IP host names and addresses for the local host and other hosts in the Internet network/etc/resolv.conf: DNS
Command
hostnslooup
DNS Port
53tcp , udp
DNS resource record
host -v -t A example.com
->example.com. 86400 IN A 172.25.254.254- A : Ipv4
- AAAA : Ipv6
- SOA
- NS : Name Server
- MX : Mail Exchange
- CNAME : Cononical Name
- TXT : Text
- SRV : Service
Bind_Named (2023.09.27)
Directery
/var/named/主要目錄/var/named/slaves/secondary zones 使用/var/named/dynamic/dynamic DNS (DDNS) zones 或 DNSSEC keys./var/named/data/統計與除錯檔案
Ways
- 正查
1 | $dnf install bind-chroot |
LLL.tw.zone
1 | $TTL 86400 |
$systemctl restart named
$chown root.named LLL.tw.zone
1 | $firewall-cmd --permanent --add-service=dns |
Command history

反解
1 | $TTL 86400 |
Unbound
/etc/unbound/unbound.conf
1 | local-zone: "example.com." static |
1 | $sudo chown -R unbound:unbound /var/lib/unbound |
Web server
HTTPd
Custom web page
Basic config
/etc/httpd/conf/http.confcustom
*.confadd in/etc/httpd/conf.d1
2
3
4
5
6
7
8
9
10
11
12
13<Directory "/var/www/html/user">
AllowOverride None
Require all granted
</Directory>
<VirtualHost *:80>
DocumentRoot "/var/www/html/user"
ServerName www.user.tw
ServerAdmin lll@nttu.edu.tw
ErrorLog "logs/user_error_log"
CustomLog "logs/user_cos_log" combined
</VirtualHost>and add dir in
/var/www/html/
nginx
/etc/nginx/nginx.conf/etc/nginx/conf.d- Add virtual server for page
edit *.conf
1 | server{ |
/usr/share/nginx/html
HTTPS
- httpd security cerify

Cache server
Varnish
- Modify service
1 | $systemctl cat varnish #get ExecStart and modify in http_port.conf |
varnish.service.d/http_port.confdaemon 參數調整
1 | [service] |
- start service
1 | $systemctl daemon-reload |
- 快取配置
/etc/varnish/default.vc
Proxy server
- 正向 & 反向代理

- 負載平衡
1 | $vim /etc/haproxy/*.conf # edit frontend and backend |
1 | $firewalll-cmd --permanent --add-service=http # open firewall for service. |
- Https 解密

- 統計

1 | stats uri /<url> # 自己指定的網頁名稱 |
Varnish + haproxy
- varnish 在haproxy後 ( 或在haproxy前 )

小結

DataBase
- MariaDB
- phpMyAdmin
1 | $sudo mysql_secure_installation # setup root passwd |
- Title: NTTU 伺服器原理 WriteUp
- Author: Chihhh Linnn
- Created at : 2024-08-06 06:28:35
- Updated at : 2024-08-06 06:28:35
- Link: https://chihhhs.github.io/2024/08/06/server/
- License: This work is licensed under CC BY-NC-SA 4.0.


