美文网首页
Debian下安装Nginx笔记

Debian下安装Nginx笔记

作者: 神农民 | 来源:发表于2017-01-25 20:47 被阅读661次

准备工作

《深入理解Nginx》中说明的预备安装包:

gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

Debian实际安装:

sudo apt-get update 
sudo apt-get install libpcre3 libpcre3-dev openssl libssl-dev libperl-dev

安装Nginx

安装Nginx的步骤:

源码下载:http://nginx.org/en/download.html

解压

./configure

make 

sudo make install

查看安装:

ls /usr/local/nginx

启动与停止

启动Nginx:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

查看Nginx进程:

ps -ef | grep nginx

kill掉进程

killall -9 nginx

验证安装

通过浏览器查看localhost页面,可以看到如下的内容:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

即证明安装成功。

问题与解决

403 Forbidden

遇到 403 Forbidden 时,可能是权限问题,在nginx.conf头部加入一行:

user  root;

然后重启nginx即可。


阅读原文 | 作者官网 | 公众号 | Feed | 订阅 | 发私信

相关文章

网友评论

      本文标题:Debian下安装Nginx笔记

      本文链接:https://www.haomeiwen.com/subject/ywfxittx.html