Nginx installation error cd.current_salt[0] = ~salt[0];
The reason for this problem is temporarily unknown.
However, it must not be the problem of the high version of Nginx or the high
version of the server because my server version is CentOS 8.3 and the version of Nginx is 1.6.2.
This version is considered high.
The whole process
cd /usr/local
- 1
Download the Nginx installation package
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
- 1
Unzip
tar -xzvf nginx-1.6.2.tar.gz
- 1
Prepare the environment
Update the software source:
sudo yum update
- 1
1.pcre 库(rewrite)
sudo yum install libpcre3 libpcre3-dev
Download link: http://www.pcre.org/
- 1
- 2
- 3
2. gcc c++ library (c++)
sudo yum install build-essential
sudo yum install libtool
- 1
- 2
- 3
3.openssl library (ssl)
sudo yum install openssl
Download link: http://www.openssl.org/
- 1
- 2
- 3
4. zlib library (gzip)
sudo yum install zlib1g-dev
Download link: http://www.zlib.net/
- 1
- 2
- 3
CentOS installation of Nginx environment preparation:
yum -y install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel
- 1
- 2
- 3
- 4
- 5
- 6
- 7
At this point, the environment is ready to be completed, if there are all kinds of weird errors in the middle, don't worry
Enter the unzipped directory
cd nginx-1.6.2/
- 1
Configuration:
./configure --prefix=/usr/local/nginx
- 1
At this time, it is in the /usr/local/nginx-1.6.2 directory
cd objs/
and Makefile
- 1
- 2
- 3
将
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g
后面的
-Werror -g
去掉
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused
- 1
- 2
- 3
- 4
- 5
- 6
- 7
Back to /usr/local/nginx-1.6.2 directory
cd ..
- 1
Compile:
make
- 1
Error
execution
vi src/os/unix/ngx_user.c
- 1
Find here
/*cd.current_salt[0] = ~salt[0];*/
- 1
Comment out, save and exit
Compile again:
make
- 1
make successful
installation:
make install
- 1
make install successful
start up
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
Note: -c specifies the path of the configuration file. If it is not added, nginx will automatically load the configuration file with the default path. You can view the help command through -h.
- 1
- 2
- 3
View the process:
ps -ef | grep nginx
- 1
Open port 80:
gedit /etc/sysconfig/iptables
service iptables restart #Finally restart the firewall to make the configuration effective
If you don't want to open the specified port, you can directly close the firewall service iptables stop
- 1
- 2
- 3
- 4
- 5
For specific firewall operations, please refer to my other blog
Portal: https://blog.csdn.net/wuekun/article/details/106411440
Start Nginx
Kill the Nginx process before starting, otherwise an error will be reported
Start Nginx command
以后都可以用这个命令启动Nginx
usr/local/nginx/sbin/nginx
- 1
- 2
- 3
Server browser input
localhost:80
- 1
Or the local browser enters the
server IP: 80
to access
This page appears as a successful installation
Common commands
1.负责裁剪的 Lua 脚本(/usr/local/Tengine/lua/ImageResizer.lua)
2. Start: /usr/local/nginx/sbin/nginx means to use the default configuration file
3.停止:/usr/local/nginx/sbin/nginx -s stop
4.重启:/usr/local/nginx/sbin/nginx -s reload
5. Check whether the configuration file (nginx.conf) is legal: /usr/local/nginx/sbin/nginx -t
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Configure load balancing
Configure dynamic and static separation
After configuring static content processing in the nginx.conf configuration file, create a folder with the same name as the project under the html folder of nginx, and set its permission to 777
Common mistakes
Nginx uses a non-default file to start an error
nginx: [emerg] open() “/usr/local/nginx/mime.types” failed (2: No such file or directory) in /usr/local/nginx/nginx.conf:18
Reason:
We put the custom nginx configuration file outside the conf directory, and the mine.types file that needs to be referenced for startup cannot be found and cannot be loaded, so an error is reported
Nginx reports 400 error when requesting
3Q
qaq
</div>