之前安装的H2O不知道为啥,总是崩溃,换Nginx了

第一步,下载最新版代码:

http://nginx.org/download/

第二步,配置:

安装额外软件包:

apt install -y libgcrypt11-dev libpcre3 libpcre3-dev libssl-dev

./configure --prefix=/usr/local/nginx  --with-http_sub_module --with-http_stub_status_module --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-openssl=/usr/bin/openssl --with-pcre=/root/pcre-8.41

后面两个并不是必加的

提示缺少openssl库,下载openssl源码解压安装,并加上:--with-openssl=OPENSSL安装路径

如果提示:PCRE library is not used试试这些操作:

1:apt-get install libpcre*

2:--with-pcre=PCRE安装路径

下载PCRE源码地址(亲测,不能用PCRE2):

https://ftp.pcre.org/pub/pcre/

第三步,编译:

make -j2

如果编译过程中提示少了openssl,可按这个操作:

vim auto/lib/openssl/conf

改为:

第四步,安装:

make install

启动试试:
/usr/nginx/sbin/nginx

停止:
查询nginx ID
ps -ef | grep nginx
从容停止Nginx:
kill -QUIT ID

重启:
kill -HUP ID

配置文件路径:
/usr/nginx/conf/nginx.conf

检测配置文件格式是否正确:
nginx -t -c /usr/nginx/conf/nginx.conf
或者
/usr/nginx/sbin/nginx -t

user  root;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream;
#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;
sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on;
server {
listen 80;
server_name www.xxx.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/wwwroot/wz;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
root /home/wwwroot/wz;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
#include fastcgi.conf;
fastcgi_param DOCUMENT_ROOT /home/wwwroot/wz;
fastcgi_param SCRIPT_FILENAME /home/wwwroot/wz$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }

  设置systemd:

 [Unit]
Description=nginx optimized HTTP server
After=network.target remote-fs.target nss-lookup.target [Service]
Type=forking
PIDFile=/tmp/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/bin/kill -HUP $MAINPID
ExecsTOP=/usr/bin/kill -s QUIT $MAINPID
privateTmp=true [Install]
WantedBy=multi-user.target

编译安装Nginx到Linux的更多相关文章

  1. linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本

    红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...

  2. 【转】linux 编译安装nginx,配置自启动脚本

    linux 编译安装nginx,配置自启动脚本 本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装ng ...

  3. linux 编译安装nginx,配置自启动脚本

    本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装nginx,记录下安装过程: 参照这篇文章:Linu ...

  4. linux服务基础之编译安装nginx

    nginx源码下载地址: http://nginx.org/download/nginx-1.16.0.tar.gz //根据需要下载其他版本 1. 下载nginx # wget http://ngi ...

  5. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  6. CentOS7 编译安装 Nginx (实测 笔记 Centos 7.0 + nginx 1.6.2)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...

  7. Centos7 编译安装 Nginx Mariadb Asp.net Core2 (实测 笔记 Centos 7.3 + Openssl 1.1.0h + Mariadb 10.3.7 + Nginx 1.14.0 + Asp.net. Core 2 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  8. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Openssl 1.1.0e + Mariadb 10.1.22 + Nginx 1.12.0 + PHP 7.1.4 + Laravel 5.4 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  9. Centos7 编译安装 Nginx PHP Mariadb Memcache扩展 ZendOpcache扩展 (实测 笔记 Centos 7.0 + Mariadb 10.1.9 + Nginx 1.9.9 + PHP 5.5.30)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1503-01.iso 安装步骤: 1.准备 1.1 ...

随机推荐

  1. VMware Workstation 12 Pro 之安装XP系统

    使用VMware Workstation 12 Pro  安装XP系统 ... <个人觉得现在没有必要再给自己的电脑装XP系统了.虽然XP很小..但是功能相比现在的Windows差很多.兼容性与 ...

  2. sdram控制2

    芯片手册要求sdram需要在64ms内刷新8K次,否则里面的数据会丢失,因此在64ms分成8192次,每次刷新充一次电,然后给两次自动刷新命令即可. /*----------------------- ...

  3. Windows权限提升基础知识和命令

    介绍 这篇文章是介绍window的权限提升,虽然不是一个全面的指南,但会试图覆盖主要的技术,常用的资源列表在文章底部,可供大家参考. window权限提升基础知识 初始信息收集 在开始提权之前,我们需 ...

  4. linux(十二)之用户管理

    前面学习了那么多关于linux的东西,相信大家都对linux应该 有一个大概的了解了.现在给大家分享的是linux中的用户管理,接下来让我们进入正题吧! 今天其实放松了一整天了,有点后悔自己没有把这些 ...

  5. 百度鹰眼Java接口调用增删改查实例

    因感觉百度鹰眼的使用场景比较符合实际业务,于是对百度鹰眼做了简单功能调试.刚开始使用springframework封装的RestTemplate,但是测试提示ak参数不存在.后又试了几种方法,均提示a ...

  6. POI设置excel某列值为文本格式

    excel单元格格式默认为[常规],当某列限定必须从下拉框选择一个纯数字文本的时候,必须将单元格格式设置为[文本]. 否则即使输入的值和下拉框的一致,excel都认为输入的值是常规类型,而下拉框的值为 ...

  7. Chome——扩展程序,获取更多扩展程序报错

    修改/替换hosts文件 地址:c:/windows/system32/drivers/etc hosts:可从网上搜索下载或网盘下载(链接: http://pan.baidu.com/s/1bpu6 ...

  8. js并行加载,顺序执行

    js并行加载,顺序执行 <script>运行脚本或加载外部文件时,会阻塞页面渲染,阻塞其他资源的加载.如果页面中需要加载多个js文件,在古老浏览器中性能会比较糟糕. 因此有了最原始的优化原 ...

  9. Intellij Idea 13 快捷键(与Eclipse比对)以及基本的设置

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt404 刚到新公司,用的台式机配置不给力,Eclipse很不给力,几个项目一起 ...

  10. 32位汇编第二讲,编写窗口程序,加载资源,响应消息,以及调用C库函数

    32位汇编第二讲,编写窗口程序,加载资源,响应消息,以及调用C库函数 (如果想看所有代码,请下载课堂资料,里面有所有代码,这里会讲解怎么生成一个窗口程序) 一丶32位汇编编写Windows窗口程序 首 ...