Before starting the service must make sure you can ping the external network, but the network of ping nowhere outside the network in a virtual machine under
Confirm vim / etc / sysconfig / network-scripts / ifcfg-ens33 (nmcli connectoin show to see your NIC name) ensuring correct these two
BOOTPROTO="dhcp",ONBOOT=yes
First, set up a web server
Package: httpd service name: httpd command to open after installation service
[root@localhost ~]# cd /var/www/html [root@localhost html]# ls index.html
[root@localhost html]# echo huihkj > index.html
[root@localhost html]# systemctl restart httpd
[root@localhost html]# firefox 192.168.142.140
Web page stored in the default directory is / var / www / html the default file name is index.html
When not under var www / html page default path / /, to modify the configuration file
But the best placed in the file index.html in the / var / www directory
/etc/httpd/conf/httpd.conf to determine the main profile page file directory, you need to modify the inside of the DocumentRoot
But the main configuration file changes pose a risk, the general call to modify the configuration file: /etc/httpd/conf.d/myweb.conf
Only need to change the root file named page like: DocumentRoot "/ var / www / myweb"
[root@localhost ~]# mkdir -p /var/www/myweb [root@localhost ~]# cd /var/www/myweb [root@localhost myweb]# echo 'I m myweb! ' > index.html [root@localhost myweb]# cd [root@localhost ~]# vim /etc/httpd/conf/httpd.conf [root@localhost ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/myweb.conf [root@localhost ~]# vim /etc/httpd/conf.d/myweb.conf [root@localhost ~]# vim /etc/httpd/conf/httpd.conf
To put the file in the root or elsewhere, was written in the call profile
<Directory "file path">
Require all granted;
</Directory>
But selinux will stop here security context
chcon -R --reference = template directory path (the default page file storage path) new directory path (path point modified)
Virtual web host
:( way to distinguish between web hosts add configurations for each virtual site)
Based virtual hosting
Based on the virtual host port
IP address-based virtual hosts
Two, ftp service
Installation package: vsftpd vsftpd install the service name after turning service
[root@localhost html]# systemctl restart vsftpd [root@localhost html]# systemctl enable vsftpd Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service. [root@localhost html]# cd /var/ftp [root@localhost ftp]# ls pub [root@localhost ftp]# mkdir haha [root@localhost ftp]# cd [root@localhost ~]# systemctl restart vsftpd [root@localhost ~]# firefox ftp://192.168.142.140
The default path is stored ftp / var / ftp
Third, the share of the several methods
Server:
1.nfs Share: Service machine provides the client with shared folders
Installation Package: nfs-utils Service Name: nfs-server
Created for the shared folder: / nfsd default shared configuration file: / etc / exports
[root@localhost ~]# mkdir /nfsd
[root@localhost ~]# vim /etc/exports
In the configuration file specifies:
/ Shared file path / client address (permission)
/nfsd *(ro)
Kai clothing:
[root@localhost ~]# systemctl restart nfs-server
[root@localhost ~]# systemctl enable nfs-server
Client:
The client uses to access shared files mount
1. First, look for a shared file server showmount -e IP
To mount the file can be accessed locally 2. mount, making access mount point
[root@zhanglei ~]# exit 登出 Connection to 192.168.142.138 closed. [root@localhost ~]# vim /etc/exports [root@localhost ~]# !sys systemctl enable nfs-server [root@localhost ~]# systemctl restart nfs-server [root@localhost ~]# gos [email protected]'s password: Last login: Sat Sep 14 14:29:48 2019 from 192.168.142.142 [root@zhanglei ~]# showmount -e 192.168.142.140 Export list for 192.168.142.140: /nfsd * [root@zhanglei ~]# mount 192.168.142.140:/nfsd /nfsd1 [root@zhanglei ~]# ls /nfsd1 1.txt [root@zhanglei ~]#
After opening the opportunity to cancel this mount can be set to start automatically mount automatically mount the file / etc / fstab down
Shared directory file path to the mount point mark detection order parameter backup type
192.168.142.140:/nfsd /nfsd1 nfs default,_netdev 0 0