PHP LNMP環境搭建

2021-08-25 08:07:29 字數 2134 閱讀 8803

# 安裝vim

yum install vim -y

# 安裝nginx

yum install -y epel-release

yum install nginx -y

# 檢視nginx軟體包包括了哪些檔案

rpm -ql nginx

# 啟動nginx

systemctl start nginx

# 檢視nginx是否啟動成功

systemctl status nginx

# 設定nginx隨機自啟動

systemctl enable nginx

# 檢視nginx主配置

vim /etc/nginx/nginx.conf

# 新建乙個站點

vim /etc/nginx/conf.d/test.actself.me.conf

# 內容如下:

server

location ~ \.php$

}# 檢視 fastcgi 相關的配置指令

view /etc/nginx/fastcgi_params

# reload nginx,使新建的站點配置生效

systemctl reload nginx

# 建立**目錄

mkdir -p /var/www/test.actself.me

# 進入網目錄,建立index.html和test.php兩個檔案

cd /var/www/test.actself.me

vim index.html

vim test.php

# 檢視linux伺服器的ip,因為test.actself.me並沒有做網域名稱配置,我們要把這個ip寫到/etc/hosts裡面才能訪問這個網域名稱

ip addr list

# 停止執行防火牆

systemctl stop firewalld

# 安裝php7

yum install

yum install

yum install yum-utils

yum install -y php72.x86_64 php72-php-cli.x86_64 php72-php-fpm.x86_64 php72-php-json.x86_64 php72-php-mbstring.x86_64 php72-php-mysqlnd.x86_64 php72-php-opcache.x86_64 php72-php-pdo.x86_64 php72-php-pecl-amqp.x86_64 php72-php-pecl-igbinary.x86_64 php72-php-pecl-mcrypt.x86_64 php72-php-pecl-memcached.x86_64 php72-php-pecl-msgpack.x86_64 php72-php-pecl-mysql.x86_64 php72-php-pecl-redis.x86_64 php72-php-pecl-yac.x86_64 php72-php-pear.noarch php72-php-pecl-zip.x86_64

# 安裝php swoole擴充套件

yum search php72 | grep swoole

yum install php72-php-pecl-swoole2.x86_64

# 啟動php-fpm

systemctl start php72-php-fpm

systemctl status php72-php-fpm

systemctl enable php72-php-fpm

# 檢視php-fpm的配置

rpm -ql php72-php-fpm

vim /etc/opt/remi/php72/php-fpm.conf

vim /etc/opt/remi/php72/php-fpm.d/www.conf

# php.ini 的配置

vim /etc/opt/remi/php72/php.ini

# 安裝mysql

yum install mariadb-server

systemctl start mariadbv

systemctl start mariadb

systemctl status mariadb

systemctl enable mariadb

LAMP環境搭建 php環境搭建

yum groupinstall development tools y yum groupinstall desktop platform development y yum install cmake pcre devel ncurses devel openssl devel libcurl ...

環境搭建 二 Python環境搭建

工欲善其事,必先利其器 要想玩轉python,我們首先需要搭建一套可使用且方便的環境。對於初學者,笨飯糰建議使用 anaconda anaconda 簡介anaconda是python的乙個科學計算發行版,內建了數百個python經常會使用的庫,包括做機器學習或資料探勘的庫。anaconda提供了乙...

環境 lamp環境搭建

以下命令全部使用root執行,如果不用root記得sudo apt update 更新一下可用軟體包列表 apt upgrade 更新已安裝的軟體包 apt install apache2 安裝apache2 systemctl start apache2 啟動apache apt install ...