nginx安装,运行(ubuntu)
文本只涉及单节点nginx
安装gcc g++依赖库
apt-get install build-essential
apt-get install libtool
安装pcre依赖库
apt-get update
apt-get install libpcre3 libpcre3-dev
安装zlib依赖库
apt-get install zlib1g-dev
安装ssl依赖库
apt-get install openssl
下载并安装
wget -P /opt/downloads http://nginx.org/download/nginx-1.15.9.tar.gz
tar zxvf /opt/downloads/nginx-1.15..tar.gz -C /opt
cd /opt/nginx-1.15.9
./configure
./configure --prefix=/opt/nginx
make
make install
修改nginx配置
vim /usr/local/nginx/conf/nginx.conf
放出pid
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info; pid logs/nginx.pid;
去掉http节点下某些注释(非必须)
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main;
验证配置文件
/usr/local/nginx/sbin/nginx -t
启动
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
注:-c 指定配置文件的路径,不加的话,nginx会自动加载默认路径的配置文件,可以通过 -h查看帮助命令。
停止
/usr/local/nginx/sbin/nginx -s stop
帮助
/usr/local/nginx/sbin/nginx -h
守护进程启动:
vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=syslog.target network.target remote-fs.target nss-lookup.target [Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload -c /usr/local/nginx/conf/nginx.conf
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
赋予权限
chmod /lib/systemd/system/nginx.service
启用守护进程
systemctl enable nginx.service
systemctl daemon-reload
运行
systemctl start nginx.service
查看日志
journalctl -f -u nginx.service
查看状态
systemctl status nginx.service
查看nginx进程
ps -ef|grep nginx
nginx安装,运行(ubuntu)的更多相关文章
- windows server,nginx安装,配置,运行nodeJS后端的web项目的实现,以及错误分析及解决方法
一.安装nginx 下载windows版nginx (http://nginx.org/download/nginx-1.12.2.zip),之后解压到需要放置的位置(C:\nginx) 二.将Ngi ...
- mac 安装nginx,并配置nginx的运行环境
1. 安装nginx // 查询有没有nginx brew search nginx //开始安装nignx brew install nginx 2. 检查nignx是否安装成功 nginx -V ...
- ubuntu 12.04 下nginx安装步骤
2013-12-05 10:25 2289人阅读 评论(0) 收藏 举报 分类: Ubuntu/Linux(17) nginx(4) 转自:http://blog.csdn.net/acccca ...
- HHvm Apache 2.4 Nginx建站环境搭建方法安装运行WordPress博客
HHvm Apache 2.4 Nginx建站环境搭建方法安装运行WordPress博客 VPS主机 2014年06月02日 17:20 评论» 文章目录 Debian上安装 Ce ...
- Windows下将nginx安装为服务运行
今天看到nginx这个小服务器软件正式版更新到了1.4.2,想玩下它.这个服务器软件虽小,但功能强大,是开源软件,有着良好的性能,被很多个人.企业,甚至大型企业所使用! 由于是在Windows下,所以 ...
- .Net Core Linux centos7行—安装nginx,运行静态网站
使用编译安装方式安装nginx Nginx下载地址:http://nginx.org/en/download.html.下载Stable version(稳定版就好).当前稳定版:http://ngi ...
- ubuntu nginx 安装以及配置文件详解
1.到nginx官网下载源码包.最好下载稳定版本,nginx官网http://www.nginx.org/ 2.安装nginx依赖包运行命令: sudo apt-get install libssl- ...
- ubuntu server nginx 安装与配置
ubuntu server nginx 安装与配置 一:关于nginx http://wiki.ubuntu.org.cn/Nginx http://nginx.org/cn http://wiki. ...
- 以非root权限安装nginx及运行
本章主要讲如何在无root权限(包含无sudo权限)条件下于centos命令行中安装nginx以及在大于1024的端口(这里用8080)上运行. 1. 安装 两种方式,一是下载预编译好的rpm包安装, ...
随机推荐
- Vue-cli 搭建web服务介绍
Node.js 之 npm 包管理 - Node.js 官网地址:点我前往官网 - Node.js 中文镜像官网: 点我前往```` Node.js 是一个基于 Chrome V8 引擎的 JavaS ...
- [PHP]session的一些要点
一.session_start([array $options=array()]) 1.只能在输出http头前启动此函数,因为如果需要改写sessid的键和值,需要在http报文头发出前就开始定义了: ...
- spring aop -包的问题
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingleton ...
- CM5.15安装kafka
cm主节点执行: [root@dip001 kafka]#ll KAFKA-.jar KAFKA---el7.parcel KAFKA---el7.parcel.sha1 manifest.json ...
- matplotlib报错_tkinter.TclError: no display name and no $DISPLAY environment variable
import matplotlib import matplotlib.pyplot as plt fig=plt.figure() #交互式测试,此时报错 解决办法,在引用后添加下面这一行 matp ...
- Confluence 6 使用 Fail2Ban 来限制登录尝试
什么是 Fail2Ban? 我们需要在我们网站中防止密码的暴利破解.Fail2Ban 是一个 Python 的应用来查看日志文件,使用的是正则表达式,同时还可以与Shorewall (或者 iptab ...
- Confluence 6 订阅所应用的所有小工具
你可以从你的 Jira, Bamboo,FishEye 或 Crucible 站点中订阅所有的小工具到你的 Confluence 小工具目录中.用户可以为他们的页面查找和选择小工具. 希望订阅其他站点 ...
- vue 中axios 的基本配置和基本概念
axios的基本概念及安装配置方法 ajax:异步请求,是一种无需再重新加载整个网页的情况下,能够更新部分网页的技术 axios:用于浏览器和node.js的基于promise的HTTP客户端 a ...
- cordova AndroidStudio3.0 升级报错问题
http://blog.csdn.net/z_Xiaozuo/article/details/78962701 ionic3 打包 安卓项目遇到的问题,当时比较冲忙升级了下android studio ...
- binary(binary区分大小写),unsigned,unsigned zerofill关键字介绍
mysql建表时,每个字段的属性有三个选项: binary,unsigned,unsigned zerofill,作用如下: 一.binary CHAR VARCHAR:值根据缺省字符集以大小写不区分 ...