- WEB service
- Install nginx package;
- The configuration file is called ispweb.conf and is placed in the /etc/nginx/conf.d/ directory;
- The root directory of the website is /mut/crypt (the directory does not exist and needs to be created);
- Enable the FastCGI function so that nginx can parse php requests;
- index.php Content Use Welcome to 2022 Computer Network Application contest!
1. Install nginx and php
[root@ispsrv /]# apt install nginx php php-fpm -y
2. Create ispweb file
The reference file is /etc/nginx/snippets/fastcgi-php.conf
/etc/nginx/sites-available/default
[root@ispsrv /]# nano /etc/nginx/conf.d/ispweb.conf
server {
listen 80 ; #网页端口监听
root /mut/crypt; #根目录
index index.php; #网页默认类型
location ~ \.php$ { #启用fastcgi
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
#可参考 nginx/目录下snippets
}
}
[root@ispsrv /]# nano /etc/nginx/nginx.conf
# include /etc/nginx/sites-enabled/*; #注释该行
3. Create the root directory of the web page
[root@ispsrv /]# mkdir /mut/crypt -p
[root@ispsrv /]# echo "Welcome to 2022 Computer Network Application contest!" > /mut/crypt/index.php
[root@ispsrv /]# systemctl restart nginx
4. Test
[root@ispsrv /]# curl 81.6.63.100
Welcome to 2022 Computer Network Application contest!