99-install

1. mac

# pcre,openSSL解压放到指定目录即可,并不需要make、install
# 安装pcre,--with-pcre=/opt/pcre/sbin
# 安装openSSL,--with-openssl=/usr/local/openssl/bin

# 生成MakeFile文件
sudo ./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-pcre=/Users/listao/soft/pcre/pcre-8.45 \
--with-openssl=/Users/listao/soft/openssl/openssl-1.1.1n

sudo make
sudo make install
  • 只是用到了PCRE libraryOpenSSL library,会进行make,不会install
image-20220404171037865
image-20220405102743944
image-20220405103752410

2. linux

CentOS6.x升级到CentOS7.x的注意事项

  1. 虚拟机中标准安装CentOS7.6步骤
  2. XShell远程连接CentOS7.6
  3. CentOS7.6模板机封装步骤
  4. VMware虚拟机链接克隆与完全克隆
  5. VMware虚拟机创建快照和还原快照
  6. CentOS7.6编译安装Redis-4.0.6例子
  7. CentOS7.x与CentOS6.x本例中用到几个区别
  8. CentOS7.6系统优化之SELinux永久关闭
  9. CentOS7.6 yum安装软件以及Redis配置文件简介
  10. CentOS7.6创建Redis.service服务实现开机自启动

1. install

Nginx 下载open in new window

  • docker => 容器化 => 应用服务器
  • kvm => 虚拟化 => 没有办法完全利用主机资源时
  • 主机 => 网关 => 1亿个文件 => cpu、内存、磁盘、网络带宽
# configure
./configure --prefix=/usr/local/nginx

./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-pcre=/root/tmp/pcre-8.45 \
--with-openssl=/root/tmp/openssl-1.1.1n \
--with-zlib=/root/tmp/zlib-1.3

# 系统已经自带,则不用这些
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel

make
make install

cd /usr/local/nginx

# 默认启动
./nginx

# 指定配置启动
./nginx -c /path/to/nginx.conf

# 修改配置后重新加载生效
./nginx -s reload

# 停止
./nginx -s stop

























 



# 防火墙
systemctl stop firewalld.service
systemctl start firewalld.service
systemctl status firewalld.service

# 防火墙生效
firewall-cmd --reload

# 禁止防火墙开机启动
systemctl disable firewalld.service

# 放行端口
# 1. zone区域
# 2. 端口、协议
# 3. 持久化,重启了是否好使
firewall-cmd --zone=public --add-port=80/tcp --permanent

# 重启linux
reboot
image-20230829213909626
CCA39D67-8E38-4B85-AEDA-01DFAACC35DF

1. 目录结构

  • conf:配置文件
  • html:静态资源
  • logs:日志
  • sbin:可执行文件
7A308809-3D9D-43F0-9A74-AEE501E42041

2. error

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.


# 安装perl库
yum install -y pcre pcre-devel

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.

# 安装zlib库(浏览器支持压缩)
yum install -y zlib zlib-devel







 







 

2. nginx.service

vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx -  web server
After=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 -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecQuit=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target
# 启动nginx
# status, start, stop, restart
systemctl start nginx.service