In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
DNS service configuration 1. Install the bind service [root@localhost sbin] # yum install bind-y.bat / omit the installation process [root@localhost sbin] # 2. View Nic information (IP address) [root@localhost named] # ifconfigens33: flags=4163 mtu 1500 inet 192.168.52.133 netmask 255.255.255.0 broadcast 192.168.52.255 inet6 fe80::3e1d:31ba:f66a:6f80 prefixlen 64 scopeid 0x20 ether 00:0c:29:27:1c:3f txqueuelen 1000 (Ethernet) RX packets 384057 bytes 558603083 (532.7 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 182891 bytes 11237471 (MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 03. Modify the main configuration file [root@localhost sbin] # vim / etc/named.confoptions {listen-on port 53 {any;}; / / 127.0.0.1 change to any listen-on-v6 port 53 {:: 1;}; directory "/ var/named"; dump-file "/ var/named/data/cache_dump.db"; statistics-file "/ var/named/data/named_stats.txt" Memstatistics-file "/ var/named/data/named_mem_stats.txt"; recursing-file "/ var/named/data/named.recursing"; secroots-file "/ var/named/data/named.secroots"; allow-query {any;}; / / localhost is changed to any [root@localhost sbin] # 4. Modify the zone configuration file [root@localhost sbin] # vim / etc/named.rfc1912.zoneszone "abc.com" IN {/ / add two zone information type master; file "abc.com.zone"; allow-update {none;};}; zone "xyz.com" IN {type master; file "xyz.com.zone"; allow-update {none;};}; [root@localhost sbin] # 5. Modify the zone data configuration file [root@localhost sbin] # cd / var/named/ [root@localhost named] # lsdata dynamic named.ca named.empty named.localhost named.loopback slaves [root@localhost named] # cp-p named.localhost abc.com.zone / / copy template and name [root@localhost named] # vim abc.com.zone $TTL 1D @ IN SOA @ rname.invalid. (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum NS @ A 127.0.0.1www IN A 192.168.52.133 / add resolution address [root@localhost named] # cp-p abc.com.zone xyz.com.zone / / the regional configuration file for copying the abc domain name is named xyz domain name [root@localhost named] # lsabc.com.zone data dynamic named.ca named.empty named.localhost named.loopback slaves xyz.com.zone [ Root@localhost named] # [root@localhost named] # systemctl start named / / enable the dns service [root@localhost named] # systemctl stop firewalld.service / / turn off the firewall [root@localhost named] # setenforce 0 / / disable the enhanced security feature [root@localhost named] # domain name-based virtual host configuration 1. Create a home file for two sites [root@localhost named] # mkdir-p / var/www/html/abc / / create an abc site [root@localhost named] # mkdir-p / var/www/html/xyz / / create a xyz site [root@localhost named] # cd / var/www/html/ [root@localhost html] # lsabc xyz [root@localhost html] # echo "this is abc web" > abc/index.html / / create a home page file [root@localhost html] # echo "this is xyz web" > xyz/index.html / / create the home file [root@localhost html] # 2. Modify nginx service configuration file [root@localhost html] # vim / usr/local/nginx/conf/nginx.conf server {listen 80; / / listen port server_name www.abc.com; / / domain name charset utf-8; / / character set. Utf-8 supports Chinese characters access_log logs/www.abc.com.access.log. / / access log location / {root / var/www/html/abc; / / site index index.html index.htm; / / supported home page type} error_page 500502 503 504 / 50x.htl; / / access error file location = / 50x.html {root html / / site}} server {listen 80; / / listening port server_name www.xyz.com; / / domain name charset utf-8; / / character set, utf-8 supports Chinese characters access_log logs/www.xyz.com.access.log / / access log location / {root / var/www/html/xyz; / / site index index.html index.htm; / / supported home page type} error_page 500502 503 504 / 50x.htl; / / access error file location = / 50x.html {root html / / site}} [root@localhost html] # 3. Check the test configuration file and restart the service [root@localhost html] # nginx-t / / check the configuration file syntax format nginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful [root@localhost html] # service nginx restart / / restart the service [root@localhost html] # 4. Open a win10 as the test machine and set the dns address
5. Test whether domain name resolution can be performed (successful)
6. Use the test machine browser to access two domain names
Port-based virtual host configuration 1. Modify the configuration file of the nginx service [root@localhost html] # vim / usr/local/nginx/conf/nginx.conf server {listen 192.168.52.133 vim 80; / / listen on port server_name www.abc.com; charset utf-8; access_log logs/www.abc.com.access.log / / access log location / {root / var/www/html/abc; / / site index index.html index.htm;} error_page 500502 503 504 / 50x.htl; location = / 50x.html {root html;}} server {listen 192.168.52.133 8080 / / listening port server_name www.abc.com; charset utf-8; access_log logs/www.abc8080.com.access.log; / / access log location / {root / var/www/html/abc8080; / / site index index.html index.htm;} error_page 500502 503504 / 50x.html Location = / 50x.html {root html;}} 2. Test configuration file [root@localhost html] # nginx-tnginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful [root@localhost html] # 3. Create port 8080 site directory and home file [root@localhost html] # mkdir abc8080/ / create site directory [root@localhost html] # echo "this is abc8080 web" > abc8080/index.html / / create home file [root@localhost html] # service nginx restart / / restart nginx service [root@localhost html] # 4. Use the test machine browser to access different ports of the same domain name
Virtual host configuration based on IP 1. Add a network card to the virtual machine
two。 View Nic information (IP address) [root@localhost html] # ifconfig ens33: flags=4163 mtu 1500 inet 192.168.52.133 netmask 255.255.255.0 broadcast 192.168.52.255 inet6 fe80::3e1d:31ba:f66a:6f80 prefixlen 64 scopeid 0x20 ether 00:0c:29:27:1c:3f txqueuelen 1000 (Ethernet) RX packets 391887 bytes 559453355 (533.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 185573 bytes 11520948 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens36: flags=4163 mtu 1500 inet 192.168.52.139 netmask 255.255.255.0 broadcast 192.168.52.255 inet6 fe80::f7fb:4ddc:f4b6:b90a prefixlen 64 scopeid 0x20 ether 00:0c:29:27:1c:49 txqueuelen 1000 (Ethernet) RX packets 14 bytes 1737 (1.6KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 24 bytes 4219 (4.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 03. Modify the resolution address [root@localhost html] # vim / var/named/xyz.com.zone$TTL 1D @ IN SOA @ rname.invalid of the domain name zone data configuration file "xyz.com.zone". (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum NS @ A 127.0.0.1www IN A 192.168.52.139 / modify the ip address to 192.168.52.139 [root@localhost html] # systemctl restart named / / restart dns service [root@localhost html] # 4. Use the testing machine to check whether the domain name resolution is normal (normal)
5. Modify the nginx service configuration file [root@localhost html] # vim / usr/local/nginx/conf/nginx.conf server {listen 192.168.52.133 listen 80; / / listen for IP address and port server_name www.abc.com; / / domain name charset utf-8; / / character set. Utf-8 supports Chinese characters access_log logs/www.abc.com.access.log. / / access log location / {root / var/www/html/abc; / / site index index.html index.htm; / / supported home page format} error_page 500502 503 504 / 50x.htl; / / access error home page file location = / 50x.html {root html / / site}} server {listen 192.168.52.139IP 80; / / listen for IP address and port server_name www.xyz.com; / / domain name charset utf-8; / / character set, utf-8 supports Chinese characters access_log logs/www.xyz.com.access.log / / access log location / {root / var/www/html/xyz; / / site index index.html index.htm; / / supported home page format} error_page 500502 503 504 / 50x.htl; / / access error home page file location = / 50x.html {root html / / site}} 6. Restart the service [root@localhost html] # nginx-t / / Test configuration file nginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful [root@localhost html] # service nginx restart / / restart the service [root@localhost html] # 7. Use the test machine to access the domain names of two different IP addresses
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.