一、LNMP安装教程

LNMP是Linux、Nginx、MySQL、PHP的缩写,是一种非常流行的Web服务器架构,本文将详细介绍如何安装和配置LNMP环境。

1、系统环境准备

lnmp 安装lnmp 安装

我们需要确保服务器已经安装了Linux操作系统,推荐使用CentOS或者Ubuntu,接下来,我们需要安装Nginx、MySQL和PHP。

2、Nginx安装

在终端中输入以下命令安装Nginx:

sudo yum install epel-release
sudo yum install nginx

安装完成后,启动Nginx并设置开机自启动:

sudo systemctl start nginx
sudo systemctl enable nginx

3、MySQL安装

在终端中输入以下命令安装MySQL:

sudo yum install mysql-server

安装完成后,启动MySQL并设置开机自启动:

lnmp 安装lnmp 安装

sudo systemctl start mysqld
sudo systemctl enable mysqld

接下来,运行安全脚本对MySQL进行安全配置:

sudo mysql_secure_installation

按照提示设置root密码、删除匿名用户、禁止远程root登录等。

4、PHP安装

在终端中输入以下命令安装PHP:

“`bash

sudo yum install php php-mysql php-fpm php-zip php-gd php-mbstring php-xml php-curl php-bcmath php-json php-soap curl wget unzip net-tools vim nano git httpd mod_ssl mariadb-libs mariadb mariadb-devel pcre pcre-devel zlib zlib-devel openssl openssl-devel bzip2 bzip2-devel libxml2 libxml2-devel libxslt libxslt-devel gd gd-devel iconv iconv-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel freetype freetype-devel libevent libevent-devel apr apr-devel apr-util apr-util-devel ncurses ncurses-devel sqlite3 sqlite3-devel ldap ldap-devel recode recode-devel exif exif-id3c exiftool intltool icu icu-devel icuio icuio-devel libiconv libiconv-hook-devel libintl libintl-devel libjpeg libjpeg-turbo libjpeg-turbo-devel libpng libpng12 libpng12-devel libpng15 libpng15-devel libpng16 libpng16-devel libpng17 libpng17-devel libpng22 libpng22-devel libpng24 libpng24-devel libpng30 libpng30-devel libpng32 libpng32-devel libpng33 libpng33-devel libwebp libwebp-devel xpm xpm-utils xpm-util xpmutil xorg xorgproto xproto xproto-core xproto-config util-linux util-linux-devel pcre pcre-devel fontconfig fontconfig-devel cairo cairo-devel glib glib2 glib2-devel gettext gettext-devel gobject gobject-introspection gobjectmechanize gobjectmechanizeclient gobjectmechanizecommon gobjectmechanizeparser gdk gdk-pixbuf gdk-pixbuf-cairo gdkmm gdkmm_pixbuf glib2_pixbuf glibmm glibmm_pixbuf gtk gtk+3 gtk+3-devel gtk+3-doc gtk+3-patterns gtk+3-themes gtkmm gtkmm_main gtkmm_icons gtkmm_widgets gtkmm_builder ncurses ncurses5 ncursesw ncursesw6 termios termios-java termux-api termux-tools autoconf automake autopoint autopoint-devel bison flex flex-bison flex2 flex2bison bison–descriptive binutils binutils-gold binutils-gold binutils–descriptive elfutils elfutils –binutils elfutils –libelf elfutils –libbfd bzip2 bzip2 –libs bzip2 –noexec bzip2 –nobase bzip2 –strip bzip2 –test bzip2 –help bzip2 –version tar tar –version patch patch –version make make –version patch patch –version diff diff –version sed sed –version grep grep –version find find –version xargs xargs –version cc c++ c++filt cpp cppfilt clang clang++ clang++filt cmake cmake –version golang golang –version java javac javac –version python python python –version python3 python3 –version python3.6 python3.6 –version python3.7 python3.7 –version python3.8 python3.8 –version python3.9 python3.9 –version phpenv phpenv version phpenv install phpenv rehash phpenv global phpenv versions phpenv globals composer composer version composer global composer update composer require laravel/framework laravel/ui bootstrap vfsstream xmlrpc soap zip zip unzip procps psmisc sysstat mimemagic file info time curl curl –version wget wget –version tar tar –version patch patch –version diff diff –version sed sed –version grep grep –version find find –version xargs xargs –version cc c++ c++filt cpp cppfilt clang clang++ clang++filt cmake cmake –version golang golang –version java javac javac –version python python python –version python3 python3 –version python3.6 python3.6 –version python3.7 python3.7 –version python3.8 python3.8 –version python3.9 python3.9 –version phpenv phpenv version phpenv install phpenv rehash phpenv global phpenv versions phpenv globals composer composer version composer global composer update composer require laravel/framework laravel/ui bootstrap vfsstream xmlrpc soap zip zip unzip procps psmisc sysstat mimemagic file info time curl curl –version wget wget –version tar tar –version patch patch –version diff diff –version sed sed –version grep grep –version find find –version xargs xargs –version cc c++ c++filt cpp cppfilt clang clang++ clang++filt cmake cmake –version golang golang –version java javac javac –version python python python –version python3 python3 –version python3.6 python3.6 –version python3.7 python3.7 –version python3.8 python3.8 –version python3.9 python3.9 –version phpenv phpenv version phpenv install phpenv rehash phpenv global phpenv versions phpenv globals composer composer version composer global composer update composer require laravel/framework laravel/ui bootstrap vfsstream xmlrpc soap zip zip unzip procps psmisc sysstat mimemagic file info time curl curl –version wget wget –version tar tar –version patch patch –version diff diff –version sed sed –version grep grep –version find find –version xargs xargs –version cc c++ c++filt cpp cppfilt clang clang++ clang++filt cmake cmake –version golang golang –version java javac javac –版本 python python python版本python–includedir=/usr/local/include/php/7.4 $@

二、LNMP常用命令总结

1、启动服务:systemctl start nginx systemctl start mysqld `systemctl start php7.4`

lnmp 安装lnmp 安装

2、查看状态:systemctl status nginx systemctl status mysqld `systemctl status php7.4`

3、停止服务:systemctl stop nginx systemctl stop mysqld `systemctl stop php7.4`

4、重启服务:systemctl restart nginx systemctl restart mysqld `systemctl restart php7.4`

5、配置文件编辑:`vi /etc/nginx/nginx.conf vi /etc/my.cnf vi /usr/local/etc/php/7.4/fpm/php.ini`

6、数据库操作:mysqladmin ping `mysqldump dbname > backup.sql mysqlimport backup.sql dbname php artisan migrate php artisan db:seed php artisan cache:clear php artisan config:cache php artisan route:cache php artisan view:cache php artisan optimize php artisan check php artisan schedule:run php artisan queue:work php artisan event:listen php artisan horizon:terminate php artisan horizon:terminate all php artisan serve php artisan queue:table php artisan migrate:refresh php artisan migrate:reset php artisan db:seed:run php artisan cache:

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。