树莓派——安装Nginx服务器

来源:互联网 发布:淘宝自动发货系统 编辑:程序博客网 时间:2024/06/07 05:43

1.安装nginx web服务器 (约6MB)

sudo apt-get install nginx -y

2.修改nginx的配置文件

sudo nano /etc/nginx/sites-available/default

以下几个选项注意一下:
listen 8080; ## listen for ipv4; this line is default and implied
//监听的端口号,如果与其它软件冲突,可以在这里更改
root /home/www;
//nginx 默认路径html所在路径
index index.html index.htm index.php;
//nginx默认寻找的网页类型,我们可以增加一个index.php
3.启动nginx

sudo /etc/init.d/nginx start

nginx的www根目录默认在 /usr/share/nginx/www中