Linux Nginx source installation vernacular

I am also a novice, and all the content is based on my own experiments and summarization through the program description and network search, so this is regarded as an experimental record, and I keep learning and improving. The


hardware system nanopi neo #This is a small development board with an ARM chip , low cost, the most important thing is to save power, you can light it 24 hours a day, haha, you can use the LINUX system
operating system armbian # seems to be an ARM version of UBUNTU, all operations have problems, you can check the processing method of UBUNTU online to solve


1. Create an nginx user
su - #Switch to ROOT user
adduser nginx #Follow the prompts, except the password is recommended to be written, others can be left blank


and switch to nginx
su - nginx


2. Download the nginx source code, and extract
it #Directly in the nginx user Download, unzip and install
wget http://nginx.org/download/nginx-1.13.12.tar.gz
tar xzvf nginx-1.13.12.tar.gz
cd nginx-1.13.12


3. Install
according to multiple times./ configure prompts to install the required components until the correct completion of
apt-get install libpcre3-dev
#When looking at the libpcre package, you will find that there are 2 and 3. To know which one has been installed in your system, you can use dpkg -l |grep pcre to view
./configure --prefix=/home/nginx #The
reason why this user is installed in this directory is that many files will be generated when used in the future. One is to facilitate management, and the other is to save trouble.
make && make install


Note: use After the nginx user is installed, it will report an error
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied),
which means that the port below 1000 can only be used by the root user, and the default website port is 80
So after the installation is complete, I changed the product to 8080 in the configuration file
vi /home/nginx/conf/nginx.conf and
found listen 80 and
changed it to listen 8080 #After the


installation is complete, run sbin/nginx, open a browser at this time, enter The URL of this server can see the default page.
For example 10.10.10.205:8080


4. Modify the environment variables, so that you don't need to always sbin when running the command in the future.
vim .bashrc #Add
these two lines after
export NGINX_HOME=/home /nginx
PATH=$PATH:$NGINX_HOME/sbin #In
the future, you can directly enter nginx under the nginx user



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325583702&siteId=291194637