Install nginx and php in Fedora
1. Install nginx
Wget https://github.com/nginx/nginx/archive/v1.7.11.zipunzip nginx-1.7.7.zip./configure -- prefix = NGINX_INSTALL_PATHmake make-f objs/Makefile installnginx generate Makefile file directly under objs.
Nginx module Installation
The biggest difference between the nginx module and the apache module is that the nginx-echo module must be re-compiled to add the module. The installation of the nginx-echo module is shown below.
wget https://github.com/openresty/echo-nginx-module/archive/v0.57.zipmkdir $NGINX_INSTALL_PATH/modulesmv echo-nginx-module-0.57.zip $NGINX_INSTALL_PATH/modules && cd $NGINX_INSTALL_PATH/modulesunzip echo-nginx-module-0.57.zip cd $NGINX_INSTALL_PATH./configure --prefix=NGINX_INSTALL_PATH --add-module=$NGINX_INSTALL_PATH/modules/echo-nginx-module-0.5
2. Install mysql
To install mysql, you can download the repo file from the mysql website.
wget http://repo.mysql.com/mysql-community-release-fc21-6.noarch.rpmsudo yum install community-mysql-server.x86_64 mysql-workbench-community.x86_64
3. install php
Php-fpm is mainly used here to execute php files. In php kernel 5.3.3 or above, php source code comes with php-fpm
Wget-c http://cn2.php.net/distributions/php-5.6.9.tar.gz (due to the large PHP file, it is best to enable resumable upload ). /configure -- prefix =/usr/local/php-5.6.9 -- enable-fpm -- with-mysqlmake & make installsudo ln-s/usr/local/php-5.6.9/usr/local/php
So we can install php and run php-fpm.
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
Now we will use the default configuration, and then enable the php-fpm service under the sbin directory.
sudo sbin/php-fpm
4. Configure php In nginx
location ~* \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include fastcgi_params; }
Start nginx now
Add the index. php file to the html directory.
Access http: // localhost/index. php
Appears
In this way, the installation and configuration of nginx and php are complete.