Nginx compilation and deployment environment installation
Before the official start, the compilation environment gcc g++ development library and the like need to be installed in advance. By default, you have already installed it.
Ububtu platform compilation environment can use the following instructions
apt-get install build-essential
apt-get install libtool
centos platform compilation environment can use the following instructions
Install make:
yum -y install gcc automake autoconf libtool make
Install g++:
yum install gcc gcc-c++
The official start is now
------------------------------------------ ------------------------------------
Generally we need to install pcre and zlib first. The former is for re-installation. Write rewrite, which is for gzip compression.
1. Select the source code directory
It can be any directory. The one selected in this article is /usr/local/src
cd /usr/local/src
2. Install the PCRE library
ftp://ftp.csx.cam.ac .uk/pub/software/programming/pcre/ Download the latest PCRE source code package. Use the following commands to download, compile and install the PCRE package:
cd /usr/local/src
wget ftp://ftp.csx.cam.ac. uk/pub/software/programming/pcre/pcre-8.35.tar.gz
tar -zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make //Used for automatic compilation
make install
3 .Install the zlib library
http://zlib.net/zlib-1.2.8.tar.gz Download the latest zlib source code package, use the following command to download, compile and install the zlib package:
cd /usr/local/src
wget http ://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
4. Install ssl (Some vps do not have ssl installed by default)
cd /usr/local/src
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c. tar.gz
5. Install nginx
Nginx generally has two versions, namely the stable version and the development version. You can choose one of these two versions according to your purpose. The following is to install Nginx to /usr/local Detailed steps under the /nginx directory:
cd /usr/local/src
wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
./configure --sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/ usr/local/nginx/nginx.pid
--with-http_ssl_module
--with-pcre=/usr/local/src/pcre-8.35
--with-zlib=/usr/local/src/zlib-1.2. 8
--with-openssl=/usr/local/src/openssl-1.0.1c
or:
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with -pcre=/root/soft/pcre-8.36
./configure --prefix=/usr/local --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx. conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/ nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client / --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre --with-file-aio -- with-http_image_filter_module ;
make
make install
--with-pcre=/usr/src/pcre-8.35 refers to the source code path of pcre-8.35.
--with-zlib=/usr/src/zlib-1.2.7 refers to the source code path of zlib-1.2.7.
After successful installation, the /usr/local/nginx directory is as follows
fastcgi.conf koi-win ime.types scgi_params.default
fastcgi_params.default mime.types.default uwsgi_params
html Occupy, run /usr/local/nginx/nginx command to start Nginx,
netstat - ano|grep 80
If no result is found, execute it. If there is a result, ignore this step (it must be started with sudo under ubuntu, otherwise it can only run in the foreground)
sudo /usr/local/nginx/nginx
Open browsing If the browser accesses the IP of this machine, if Welcome to nginx! appears on the browser, it means that Nginx has been installed and run successfully.
The above introduces the installation of Nginx compilation and deployment environment, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

The methods that can query the Nginx version are: use the nginx -v command; view the version directive in the nginx.conf file; open the Nginx error page and view the page title.

How to configure an Nginx domain name on a cloud server: Create an A record pointing to the public IP address of the cloud server. Add virtual host blocks in the Nginx configuration file, specifying the listening port, domain name, and website root directory. Restart Nginx to apply the changes. Access the domain name test configuration. Other notes: Install the SSL certificate to enable HTTPS, ensure that the firewall allows port 80 traffic, and wait for DNS resolution to take effect.

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".
