Preface
Step on the pit + memo, one-click configuration script depth, so use official links
Reference link
v2ray document
https://www.v2ray.com/chapter_00/install.html
nginx architecture
https://blog.csdn.net/fengfeng0328/article/details/82828224
Overall process
https://www.xpath.org/blog/001531048571577582cfa0ea2804e5f9cb224de052a4975000
1. Application for domain name
2. CDN settings
2.1 Add records and make clouds black
2.2 DNS Server to Change Domain Name
* 2.3 After all the tests are successful, turn on the CDN and check ping
3 v2ray server-side installation
install bash <(curl -L -s https://install.direct/go.sh) //To configure nano /etc/v2ray/config.json //content { "inbounds": [ { "port": xxxxx, "protocol": "vmess", "settings": { "clients": [ { "id": "xxxx", "alterId": 64 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path": "/ray" //Directories in nginx } } } ], "outbounds": [ { "protocol": "freedom", "settings": {} } ] } //Common instructions systemctl enable v2ray systemctl start v2ray systemctl stop v2ray systemctl restart v2ray systemctl status v2ray
4.Nginx Installation and Configuration
4.1 Install Nginx
1.install apt-get update apt-get install nginx service apache2 stop Maybe it's a way to solve the problem of not being able to install it. 2.Firewall configuration ufw app list //Result Nginx Full Nginx HTTP Nginx HTTPS ufw allow 'Nginx Full' //Allow 80 + 443 ufw enable ufw status 3.Inspection of operation status systemctl status nginx //normal operation ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) 4.Test default address wget http://127.0.0.1 //Success is fine, or use nano to view content nano index.html
4.2 Nginx process management
start-up systemctl start nginx restart systemctl restart nginx Reload systemctl reload nginx No startup systemctl disable nginx Set up boot start systemctl enable nginx
4.3 Setting up Service Block
1.Create directories mkdir -p /var/www/example.com/html 2.Use $USER Environmental variables allocate ownership of directories chown -R $USER:$USER /var/www/example.com/html/ //or chmod -R 755 /var/www/example.com/ 3.Establish demo nano /var/www/example.com/html/index.html <html> <head> <title>This is the title.</title> </head> <body> <h1>This is the content.</h1> </body> </html> 4.Create a server block nano /etc/nginx/sites-available/example.com //Put in the content (changes will be made later) server { listen 80; listen [::]:80; root /var/www/example.com/html; index index.html index.htm index.nginx-debian.html; server_name example.com www.example.com; location / { try_files $uri $uri/ =404; } } 5.Create link startup ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/ *6 In order to avoid hash bucket memory problems caused by adding additional server names, it is necessary to adjust/etc/nginx/nginx.conf A single value in a file. nano /etc/nginx/nginx.conf //Find the server_names_hash_bucket_size instruction and delete the # symbol to uncomment the line: ... http { ... server_names_hash_bucket_size 64; ... } ... 7 Testing grammatical errors nginx -t //Success nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful 8 restart systemctl restart nginx 9 Verification http://example.com
* 4.4 Nginx files and directories
nginx server configuration file:
/ etc/nginx: Nginx configuration directory. All Nginx configuration files reside here.
/ etc/nginx/nginx.conf: The main Nginx configuration file. This can be modified to change the Nginx global configuration.
/ etc/nginx/sites-available/: A directory that stores each site server block can be stored. Unless Nginx links to sites-enabled and sites-enabled directory, Nginx will not use the configuration files in this directory. Typically, all server block configurations are done in this directory and then enabled by linking to other directories.
/ etc/nginx/sites-enabled/: A directory that stores each site server block enabled. Typically, these are created by linking to configuration files in the sites-available directory.
/ etc/nginx/snippets: This directory contains configuration fragments that can be included elsewhere in the Nginx configuration. Repeatable configurable fragments can be reconstructed into fragments.
nginx server log file:
/ var/log/nginx/access.log: Unless Nginx is configured in other ways, every request to your Web server is recorded in this log file.
/ var/log/nginx/error.log: Any Nginx error is recorded in this log.