树莓派nginx无法安装mysql_树莓派Raspberry Pi 3 安装nginx服务

树莓派安装的CentOS用不了第三方软件园,只好通过make install安装nginx

1. 下载nginx软件源码:

wget http://nginx.org/download/nginx-1.10.3.tar.gz

tar xf nginx-1.10.3.tar.gz

2. 利用yum 安装pcre pcre-devel openssl 等包

yum install pcre pcre-devel openssl openssl-devel gcc -y

3. 开始安装

cd nginx-1.10.3

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

make && make install

4. 配置

cd /usr/local/nginx/conf

sed -n 30,40p nginx.conf

//检查语法

/usr/local/nginx/sbin/nginx -t

输出:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

则为配置正确,但是有可能会报错:

[emerg] getpwnam("nginx") failed

错误的原因是没有创建nginx这个用户,应该在服务器系统中添加nginx用户组和用户nginx,如下命令:

/usr/sbin/groupadd -f nginx

/usr/sbin/useradd -g nginx nginx

5. 启动nginx服务:

/usr/local/nginx/sbin/nginx

启动后查看是否运行成功:

ps aux | grep nginx

//输出

root 4034 0.0 0.1 8144 1852 ? Ss 12:13 0:00 nginx: master process ./sbin/nginx

nginx 4035 0.0 0.3 8284 2908 ? S 12:13 0:00 nginx: worker process

root 4121 0.0 0.0 2680 572 pts/0 S+ 12:29 0:00 grep --color=auto nginx

可以访问本地端口试试:

curl -I localhost:80

//输出

HTTP/1.1 200 OK

Server: nginx/1.10.3

Date: Thu, 05 Oct 2017 12:13:55 GMT

Content-Type: text/html

Content-Length: 612

Last-Modified: Thu, 05 Oct 2017 11:00:46 GMT

Connection: keep-alive

ETag: "59d610de-264"

Accept-Ranges: bytes

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值