uos nginx 部署
时间: 2024-01-27 17:15:26 浏览: 101
以下是在UOS上部署nginx的步骤:
1. 安装nginx和php:
```shell
apt install nginx php php-fpm -y
```
2. 创建配置文件ispweb.conf并将其放置在/etc/nginx/conf.d/目录下:
```shell
touch /etc/nginx/conf.d/ispweb.conf
```
3. 编辑ispweb.conf文件,添加以下内容:
```shell
server {
listen 80;
server_name localhost;
root /mut/crypt;
index index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```
4. 创建网站根目录/mut/crypt(如果目录不存在):
```shell
mkdir -p /mut/crypt
```
5. 创建index.php文件并将其内容设置为"Welcome to 2022 Computer Network Application contest!":
```shell
echo "Welcome to 2022 Computer Network Application contest!" > /mut/crypt/index.php
```
6. 启动nginx和php-fpm服务:
```shell
systemctl start nginx
systemctl start php7.4-fpm
```
现在,您已经成功在UOS上部署了nginx,并将网站根目录设置为/mut/crypt,并启用了FastCGI功能以解析php请求。
阅读全文
相关推荐














