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.
Apt get update
apt install nginx;
after installation, the service will be automatically executed,
systemctl status nginx;
Configure the firewall
ufw allow 'Nginx;
Successful execution interface
all Nginx configuration files are located in
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
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 :
SCP upload and download
1, from the server to download file
SCP username @ servername:/path/filename/Users/MAC/Desktop (local directory) code>
SCP [email protected]:/root/zouzouzou. TXT/Users/MAC/Desktop code> is the server/root/zouzouzou. TXT/Users/MAC/downloaded to a local Desktop directory.
SCP - r/raid5 ZXX/my_download/zouzouzou.zip/users/zhuxiaoxia/Desktop code>
2. Upload local files to the server
SCP /path/filename [email protected]:/path;
SCP/Users/MAC/Desktop/zouzouzou. TXT [email protected]:/root/ code>
3. Download the whole directory
scp-r [email protected]:/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 [email protected]:remote_dir
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.
- Mac realizes file interaction (upload and download) between terminal and server
- Winscp failed to upload the file to the server, indicating permission denied with return code 3
- /var/run/nginx/nginx.pid” failed (2: No such file or directory)
- Linux configuration SFTP server
- Nginx startup error: nginx: [error] open() “/ var / run / nginx/ nginx.pid The solution of “failed (2: no such file or directory)”
- nginx: [error] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
- ssh can connect but sftp can not connect
- Nginx installation in MAC
- Error！ Failed to start nginx
- subsystem request failed on channel 0 Couldn’t read packet: Connection reset by peer
- nginx: [error] open() “/usr/local/var/run/nginx.pid” failed (2: No such file or directory)
- xrdp_mm_process_login_response:login failed
- Nginx configures different domain names to access different projects
- nginx: [error] invalid PID number in /var/run/nginx.pid
- SFTP login error: fatal error: received unexpected end of file from SFTP server
- failed: Error during WebSocket handshake: Unexpected response code: 400
- Nginx error: nginx: [error] invalid PID number “” in “/run/nginx.pid”
- Error code 2: Access violation error.
- Nginx reverse proxy MySQL
- The garbled problem of hot deployment in nginx