为什么只有中国做网站需要备案,企业网站类型,网站建设人员需求,新手做网站教程一、版本适配 版本一定要适配#xff0c;否则会报错各种参数定位不到不识别的错误#xff0c;以下是版本适配信息#xff0c;各位观客自行按照以下信息匹配版本。
Nginx 1.11.5及以上版本与OpenSSL 1.0.2及以上版本兼容。Nginx 1.15.2及以上版本与OpenSSL 1.1.1及以上版本兼…一、版本适配 版本一定要适配否则会报错各种参数定位不到不识别的错误以下是版本适配信息各位观客自行按照以下信息匹配版本。
Nginx 1.11.5及以上版本与OpenSSL 1.0.2及以上版本兼容。Nginx 1.15.2及以上版本与OpenSSL 1.1.1及以上版本兼容。
二、配置步骤
步骤一 下载nginx1.15.2 网址http://nginx.org/download/nginx-1.15.2.tar.gz
步骤二 安装nginx依赖库 $ yum install gcc-c
$ yum install pcre pcre-devel
$ yum install zlib zlib-devel
$ yum install openssl openssl--devel
步骤三 安装nginx配置好nginx.conf为https后启动即可以https形式进行访问
#下载安装nginx-1.15.2.tar.gz
tar -zxvf nginx-1.15.2.tar.gz #解压后会在当前目录中生成一个nginx-1.15.2目录#使用--prefix参数指定nginx安装的目录,make、make install安装
cd nginx-1.15.2
./configure --prefix/usr/local/nginx --with-http_ssl_module #此参数可以不指定默认安装的位置 就是/usr/logcalhttp_ssl_module为支持ssl
make
make install#如果没有报错则安装完成若报错则需要行为library以openssl-1.1.1v为例
./configure --prefix/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl/root/openssl-1.1.1v/
#查找nginx的安装目录
whereis nginx 三、nginx.conf配置内容
# https配置
server {listen 443 ssl; #开放端口server_name 域名;#域名#redirect to https#ssl on; #旧版#ssl证书地址ssl_certificate /usr/local/nginx/ssl/***.pem; #pemssl_certificate_key /usr/local/nginx/ssl/***.key; #key#代理请求http接口location /cloudapis/ {proxy_pass http://ip:port/;}location / {root gscmh/dist;index index.html index.htm;}
}
四、make时的常见错误处理
1、错误提示
make[1]:*** [objs/nginx] Error 1
make[1]:Leaving directory /usr/local/nginx/nginx-1.12.0
make[1]:*** [build] Error 2 2、解决措施
打开nginx安装源的auto/lib/openssl路径下修改conf文件,如下图所示 定位openssl-1.1.1v目录下是没有lib直接在一级目录下所以需要需改改配置文件的内容删除掉lib即可正常make 五、常用指令
1、linux
- 复制文件 cp -r /path/goal_folder /goal_path/
- 查看端口进程 netstat -tlnp|grep port
- 杀死进程kill -9 {pid}
- 设置启动加载文件上限ulimit -n num
2、nginx
- 启动命令./nginx
- 重启命令./nginx -s reload
- 杀进程停止命令./nginx -s quit
- 停止应用命令./nginx -s stop