I. Configuration parsing PHP
Edit Nginx configuration file /usr/local/nginx/conf/nginx.conf
[Email protected] ~]# vim/usr/local/nginx/conf/nginx.conf
We need to open the configuration line for PHP and find these lines:
#location ~ \.php$ { # root html; # Fastcgi_pass 127.0.0.1:9000; # Fastcgi_index index.php; # Fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #}
1. Place "Fastcgi_pass 127.0.0.1:9000;" Change to "Fastcgi_pass unix:/tmp/www.sock;"
2. Place "Fastcgi_param script_filename/scripts$fastcgi_script_name;"
Change to "Fastcgi_param script_filename/usr/local/nginx/html$fastcgi_script_name;"
Results after the change:
Location ~ \.php$ { root html; Fastcgi_pass Unix:/tmp/www.sock; Fastcgi_index index.php; Fastcgi_param script_filename /usr/local/nginx/html$fastcgi_script_name; Include fastcgi_params; }
Note: 1. /usr/local/nginx/html is the root of the site, the Web page is only available to be found
2.php currently listening socket file for /tmp/www.sock, nginx through this file and PHP communication
Two. Check if Nginx configuration is correct, reload Nginx
[Email protected] ~]#/usr/local/nginx/sbin/nginx-tnginx:the configuration file/usr/local/nginx/conf/nginx.conf Syntax is oknginx:configuration file/usr/local/nginx/conf/nginx.conf test is successful[[email protected] ~]# [[Email PR Otected] ~]#/usr/local/nginx/sbin/nginx-s Reload
Three. Turn off firewall selinux and iptables
To turn off SELinux:
[Email protected] ~]# Vim/etc/selinux/config
Change the "selinux=enforcing" configuration line to "selinux=disabled" and save the Exit!
[Email protected] ~]# Getenforce
Enforcing
Note: Getenforce is a temporary shutdown of the SELinux command
To empty the Iptables filter table:
[[email protected] ~]# iptables-f[[email protected] ~]#/etc/init.d/iptables saveiptables: Save firewall rules to/etc/sysconfig/ Iptables: [OK]
Note: 1. " iptables-f"command to empty the default Table filter table for iptables.
2. "/etc/init.d/iptablesSave" saves the current rule
Four. Test parsing PHP
To test whether you can access the Web home page:
[[email protected] ~]# Curl localhost-ihttp/1.1 OK
We can also use the browser to access, in the browser to lose the server IP address! This experiment virtual machine IP is 192.168.199.226)
Test parsing PHP:
[Email protected] ~]# cd/usr/local/nginx/html/[[email protected] html]# vim info.php
The content is written as:
<?php
Phpinfo ();
?>
To access PHP files:
http://192.168.199.226/info.php
PHP File loaded successfully!
Five. Installing Discuz
Download Unzip Discuz:
[[email protected] ~]# mkdir/data/www[[email protected] ~]# cd/data/www[[email protected] www]# wget http://download.com Senz.com/discuzx/3.2/discuz_x3.2_sc_gbk.zip
[Email protected] www]# Unzip Discuz_x3.2_sc_gbk.zip
[Email protected] www]# mv upload/*.
[Email protected] www]# RM-RF readme/utility/upload/discuz_x3.2_sc_gbk.zip
Modify the Nginx configuration file to access the directory as/data/www by default:
[Email protected] www]# vim/usr/local/nginx/conf/nginx.conf
1. Locate the following configuration line:
Location/{ root html; Index index.html index.htm; }
and change it to:
Root /data/www; Index index.html index.htm index.php;
2. Locate the configuration line " Fastcgi_param script_filename/usr/local/nginx/html$fastcgi_script_name;" Replace the /usr/local/nginx/html with the /data/www
Save Exit!
[Email protected] www]#/usr/local/nginx/sbin/nginx-tnginx:the configuration file/usr/local/nginx/conf/nginx.conf Syntax is oknginx:configuration file/usr/local/nginx/conf/nginx.conf test is successful[[email protected] www]#/usr/lo Cal/nginx/sbin/nginx-s Reload
The browser uses IP address access again to start installing discuz!
Six. Discuz configuration on the Web
1. After displaying the Discuz Installation Wizard, click I agree
2. Perform the following command on the server to remove those red forks:
[[email protected] www]# cd/data/www/[[email protected] www]# chown-r php-fpm config data uc_client/data uc_server/data
3. Click Next
4. Select the new Installation Discuz and click Next
5. Create the database and user on MySQL:
[Email protected] ~]# Mysqlwelcome to the MySQL Monitor. Commands End With; or \g.mysql> CREATE database discuz; Query OK, 1 row Affected (0.00 sec) Mysql> Grant all on discuz.* to ' huh ' @ ' localhost ' identified by ' 123456 '; Query OK, 0 rows affected (0.01 sec) mysql> Quitbye
6. Fill in the database Information and administrator information:
fill in the database information:
database server: localhost
database name: Discuz
database user name: Huh
Database Password: 123456
* * * (others remain unchanged)
fill in the Administrator information
Admin Account: admin
Administrator Password: 123456
duplicate Password: 123456
Installation is successful!
004. Test parsing PHP, installing Discuz