CentOS rpm installation and configuration of NginxOfficial download address: http://nginx.org/en/download.html introduceNginx ("engine x") is a high-performance Web and reverse proxy server developed by Russian programmer Igor Sysoev. It is also an IMAP/POP3/SMTP proxy server. rpm package installation#Install nginx, rpm installation#rpm install nginx package rpm -Uvh --force --nodeps nginx-1.16.1-1.el7.ngx.x86_64.rpm #Check the startup status systemctl status nginx The display is as follows: ● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since 2021-11-26 11:12:41 CST; 5 days ago Docs: http://nginx.org/en/docs/ Process: 1379 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 1543 (nginx) Tasks: 5 CGroup: /system.slice/nginx.service ├─1543 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf ├─1544 nginx: worker process ├─1546 nginx: worker process ├─1547 nginx: worker process └─1548 nginx: worker process November 26 11:12:41 liang systemd[1]: Starting nginx - high performance web server... November 26 11:12:41 liang systemd[1]: Started nginx - high performance web server. #Start systemctl start nginx #Restart systemctl restart nginx #Startup service systemctl enable nginx #Check the boot status enabled: enabled, disabled: disabled systemctl is-enabled nginx After installation, modify the /etc/nginx/conf.d/default.conf configuration file. The reference content is as follows: vim /etc/nginx/conf.d/default.conf server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location /ui { alias /data/dist; index index.html index.htm; } location /file/ { root /home/data/; index index.html index.htm; } # websocket configuration wss location /liangws/ proxy_pass http://192.168.0.19:8080/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Remote_addr $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 600s; } location ~ /gat { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:18080 ; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { #root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; #include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } Note: Static file downloading depends on nginx. We need to put these files in the directory corresponding to /home/data/aaa in the nginx configuration file. Start service configurationcat /usr/lib/systemd/system/nginx.service [Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/var/run/nginx.pid ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target This is the end of this article about installing Nginx and configuring it with rpm on CentOS system. For more information about installing Nginx with rpm on CentOS, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to use resize to implement image switching preview function
>>: Comparison of div and span in HTML_PowerNode Java Academy
Get the current date + time (date + time) functio...
The default ssh port number of Linux servers is g...
The front-end development department is growing, ...
DML operations refer to operations on table recor...
In an article a long time ago, I talked about the...
Table of contents Separation effect Command line ...
To achieve an effect similar to Windows forms, dr...
Collapsed headers are a great solution for displa...
The reason is that it was not uninstalled cleanly...
Table of contents 1. The default focus is on the ...
Table of contents Method 1: The simplest way to s...
When position is absolute, the percentage of its ...
This article shares with you the solution to the ...
Table of contents 1. DateTimePicker date selectio...
This article is the second article about objects ...