Install Nginx, configure firewall and file structure; SFTP transfer download, SCP upload download.
// it is not clear here that it is very similar to the last one.
Nginx
Install Nginx
Apt get update
apt install nginx
;
after installation, the service will be automatically executed,
verification: systemctl status nginx
;
Configure the firewall
ufw allow 'Nginx
;
verification :ufw status
;
Successful execution interface
File structure
all Nginx configuration files are located in /etc/nginx
directory.
the main configuration file for Nginx is /etc/nginx/nginx.conf
. To make the Nginx configuration easier to maintain, it is recommended to create a separate configuration file for each domain. You can have as many server block files as you want.
Nginx server prevents files from being stored in the /etc/nginx/ locations-available
directory. Nginx will not use the configuration files found in this directory unless they are linked to the /etc/nginx/ location-enabled
directory.
to activate the server block, you need to create a symbolic link (pointer) from the configuration file site in the sites-available directory to the directory sites-enabled.
is recommended to follow standard naming conventions. For example, if your domain name is mydomain.com, then your configuration file should be named /etc/nginx/sites-available/mydomain.com.conf code>
the/etc/nginx/snippets directory contains can included in the configuration file from the server. If you use repeatable configuration segments, you can refactor these segments into fragments and include the fragment file in the server block.
Nginx log files (access.log and error.log) are located in the /var/log/ Nginx
directory. It is suggested that there are different Access, and the error is the log file of each server module.
The MAC sends files to the server
SFTP transfer download
Create a new remote connection in the shell and send it using SFTP (prompted for server password) :
Use put to send command: put local file path remote path
; The
put command cannot upload a folder directly. Can be packaged for delivery.
use the get download command get remote path
;
use bye to exit SFTP :bye
.
SCP upload and download
1, from the server to download file SCP username @ servername:/path/filename/Users/MAC/Desktop (local directory) code>
For example: SCP [email protected]:/root/zouzouzou. TXT/Users/MAC/Desktop code> is the server/root/zouzouzou. TXT/Users/MAC/downloaded to a local Desktop directory.
[email protected]: SCP - r/raid5 ZXX/my_download/zouzouzou.zip/users/zhuxiaoxia/Desktop code>
2. Upload local files to the server SCP /path/filename username@servername:/path
;
For example, SCP/Users/MAC/Desktop/zouzouzou. TXT [email protected]:/root/ code>
3. Download the whole directory scp-r username@servername:/root/ (remote directory) /Users/ MAC /Desktop (local directory)
For example : scp-r [email protected]:/root/ /Users/ MAC /Desktop/
4. Upload directory to server scp-r local_dir username@servername:remote_dir
For example: scp-r test [email protected]:/root/ upload the test directory under current directory to the server's /root/ directory
Reminder: The target server wants to enable write permission.