Original Address: http: //blog.sina.com.cn/s/blog_150f554f50102yhra.html
A. Installing Nginx and PHP7
1, install Nginx
sudo apt install -y nginx
sudo systemctl restart nginx
2, installation PHP7
sudo apt install -y php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-mcrypt php7.0-cgi php7.0-mysql
sudo systemctl restart php7.0-fpm
3, the installation is successful, through http: Nginx access to the default page of // IP. Nginx root directory / var / www / html.
Nginx configuration to make Nginx can handle PHP
4. Edit
sudo vim /etc/nginx/sites-available/default
# Will be one of the following
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $ on $ a / = 404;
}
Replace #
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $ on $ a / = 404;
}
location ~\.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
client_max_body_size 256m;
5, modify upload file size limit:
# Open the configuration file
sudo vim /etc/php/7.0/fpm/php.ini
# Each script run the maximum time, in seconds, 0 to infinity
max_execution_time = 0
# Each script can consume time, also expressed as seconds
max_input_time = 300
# Script runs the largest consumer of memory
memory_limit = 256M
# Form submission data for the maximum 8M, restrictions for the entire form submission data
post_max_size = 20M
The maximum allowed size of uploaded files #
upload_max_filesize = 10M
6, the configuration php-fpm
Nginx need to select the form and services connected to php, tcp mode or a socket mode.
Find www.conf file, different platforms will lead to a different file location.
I'm in /etc/php/7.0/fpm/pool.d,
As well as in etc / php-fpm.d of.
Edit www.conf file reference:
vim /etc/php/7.0/fpm/pool.d/www.conf
Find the parameter listen = /run/php/php7.0-fpm.sock
If the corresponding parameter is described XXXX.sock php-fpm through the socket contact pattern and Nginx.
If the corresponding parameter is described php-fpm 127.0.0.1 through the socket contact pattern and Nginx.
Can modify according to their needs, keep in mind that this parameter, which will be used when configuring Nginx.
7, restart Nginx
sudo service nginx restart
8, add a PHP file test
sudo vim /var/www/html/index.php
9, mysql configure remote login privileges
Method One: Set up a new remote user
CREATE USER 'user'@'%' IDENTIFIED BY 'user';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'user' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Method two: the root user to directly modify the permissions of remote
USE mysql;
UPDATE user SET host = '%' WHERE user = 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;
FLUSH PRIVILEGES;
'[Username]' @ '[ip accessible to all%]' identified by '[password]', then the table would not be authorized, but in order to ensure, and I authorize it again.
After the completion of exit database
exit;
Open /etc/mysql/mariadb.conf.d/50-server.cnf
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Comment out the bind-addres will be changed to 0.0.0.0
10, install phpmyadmin
# Download
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0.1/phpMyAdmin-4.8.0.1-all-languages.tar.gz
tar zxvf phpMyAdmin-4.8.0.1-all-languages.tar.gz
# Mobile
sudo mv phpMyAdmin-4.8.0.1-all-languages /var/www/html/mysql
# Copy a configuration file
cd /var/www/html/mysql
sudo cp config.sample.inc.php config.inc.php
# And modified to `` localhost` 127.0.0.1`
sudo nano config.inc.php
# Installation php7.0-mbstring
sudo apt install -y php7.0-mbstring
Third, related commands
sudo chmod -R 777
sudo systemctl restart php7.0-fpm
sudo service nginx restart
/etc/init.d/nginx restart
/etc/init.d/php7-fpm restart
service mysql restart
Raspberries come in the lnmp, creating a website "to solve the problem can not access phpmyadmin mysql raspberries come in the https://blog.csdn.net/qq_15947947/article/details/79638050
Raspberry Pi UFW simple firewall settings
http://shumeipai.nxez.com/2014/06/09/simple-raspberry-pi-ufw-firewall-settings.html
https://www.cnblogs.com/jikexianfeng/p/6899572.html
Raspberry Pi SSH connection -SSH service installation and boot automatically activated
https://blog.csdn.net/qq813480700/article/details/71597808
Raspberry Pi is set to display Chinese
https://blog.csdn.net/dear521520/article/details/78357705
Raspberry Pi Chinese garbled solution
https://blog.csdn.net/y511374875/article/details/73548195
(NGINX + PHP + MYSQL5.7) environment to build
https://blog.csdn.net/kxwinxp/article/details/80299429