Isaac Li

码农 + 测试


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

nginx 安装配置

发表于 2018-07-09 | 分类于 Linux

一、安装编译工具及库文件

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

二、安装 PCRE

PCRE 作用是让 Nginx 支持 Rewrite 功能。

1、下载 PCRE 安装包,下载地址:http://downloads.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.gz

wget http://downloads.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.gz

2、解压安装包

tar -zxvf pcre-8.42.tar.gz

3、进入安装包目录

cd pcre-8.42/

4、编译安装

./configure
make && make install

5、查看pcre版本

pcre-config --version

三、安装 Nginx

1、下载 Nginx,下载地址:http://nginx.org/download/nginx-1.14.0.tar.gz

wget http://nginx.org/download/nginx-1.14.0.tar.gz

2、解压安装包

tar -zxvf nginx-1.14.0.tar.gz

3、进入安装包目录

cd nginx-1.14.0/

4、编译安装

./configure  \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_stub_status_module \
--with-http_ssl_module

make 

检查输出信息,编译没有错误再进行安装

make install

5、查看nginx版本

/usr/local/nginx/nginx -v    

四、Nginx 配置

1、创建 Nginx 运行使用的用户和用户组 nginx

groupadd nginx
useradd -g nginx nginx

2、配置nginx.conf

vi /usr/local/nginx/nginx.conf

修改

user nginx nginx;
error_log /usr/local/nginx/logs/nginx_error.log
pid /usr/loacl/nginx/nginx.pid
gzip on;
charset gb2312;

五、启动 Nginx

Nginx 启动命令如下:

/usr/local/nginx/nginx -t

Postman URL参数化

发表于 2018-07-07 | 分类于 Auto Test
  1. 打开 Postman,新建或打开一个 Request
  2. 点击右上角的⚙️
  3. 点击 Add an n

VNC 窗口黑屏问题

发表于 2018-07-04 | 分类于 Linux
1. 安装安装X-Window
# yum check-update
# yum groupinstall "X Window System
# yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
# unlink /etc/systemd/system/default.target
# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
# reboot #重启机器
2. 安装 vnc
# yum install tigervnc-server -y
3. 从VNC备份库中复制service文件到系统service服务管理目录下
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service 
4. 修改vncserver@:1.service文件

当前使用的用户是 root,如果使用其他用户登录,需要把文件中的 root 替换成登录用户

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i "
PIDFile=/home/root/.vnc/%H%i.pid

修改文件使配置生效:

# systemctl daemon-reload
5. 为vncserver@:1.service设置密码
# vncpasswd
6. 启动VNC
# systemctl enable vncserver@:1.service #设置开机启动
# systemctl start vncserver@:1.service #启动vnc会话服务
# systemctl status vncserver@:1.service #查看nvc会话服务状态
# systemctl stop vncserver@:1.service #关闭nvc会话服务
# netstat -lnt | grep 590*      #查看端口
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN     
7. 存在的问题

当使用 vnc 客户端登录时,遇到了黑屏问题,完全看不到 centos 的桌面,后发现问题出在变量 $PATH 上了,因为服务器上安装了 Anaconda,所以配置变量 $PATH 会写成
export PATH=”/root/anaconda3/bin:$PATH”
解决方法, 修改文件 ~/.bashrc

export PATH="$PATH:/root/anaconda3/bin"

保存文件,并使配置文件生效,重新登录 vnc ,问题解决

Hello World

发表于 2018-06-29 | 分类于 Linux

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

1…45
Isaac Li

Isaac Li

44 日志
9 分类
36 标签
Links
  • deeplearning.ai
  • AI初学者
  • fast.ai
  • IBM Developer
  • Java Anti-Patterns
  • Tim Dettmers's blog
  • colash's blog
  • 阮一峰的网络日志
  • Dylan's blog
  • shartoo's blog
  • DATAQUEST
  • Java技术驿站
  • w3schools
  • 在线正则表达式测试
© 2018 Isaac Li
由 Hexo 强力驱动
|
主题 — NexT.Pisces v5.1.4