Kali配置LNMP环境

tomosak2年前Linux593

安装Nginx

└─$ sudo apt-cache policy nginx
nginx:
  已安装:(无)
  候选: 1.22.0-1
  版本列表:     1.22.0-1 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages                                                                                                                                  
└─$ sudo apt install nginx-full 
└─$ sudo nano /etc/nginx/sites-available/default      //nginx
      

└─$ sudo systemctl start nginx

安装PHP和PHP扩展

┌──(kele㉿Roonready)-[/]
└─$ sudo apt-cache policy php php-fpm
php:
  已安装:(无)
  候选: 2:8.1+92
  版本列表:     2:8.1+92 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages
php-fpm:
  已安装:(无)
  候选: 2:8.1+92
  版本列表:     2:8.1+92 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages
                                                                                                                                     
┌──(kele㉿Roonready)-[/]
└─$ sudo apt install php8.1 php8.1-fpm
└─$ sudo php -v                       
PHP 8.1.5 (cli) (built: May 16 2022 17:15:25) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.5, Copyright (c) Zend Technologies    with Zend OPcache v8.1.5, Copyright (c), by Zend Technologies

配置Nginx和PHP-FPM

└─$ sudo nano /etc/nginx/sites-available/default

        root /home/music;        # Add index.php to the list if you are using PHP
        index index.php 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 $uri $uri/ =404;
        }        # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;        #
        #       # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/run/php/php8.1-fpm.sock;   //php这里注意版本        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

└─$ sudo nano /etc/php/8.1/fpm/pool.d/www.conf 
; Note: This value is mandatory.
listen = /run/php/php8.1-fpm.sock

┌──(kele㉿Roonready)-[/]
└─$ sudo systemctl restart nginx.service      
                                                                                                                                     
┌──(kele㉿Roonready)-[/]
└─$ sudo systemctl restart php8.1-fpm.service

测试

┌──(kele㉿Roonready)-[/home/music]
└─$ sudo nano test.php        


ctrl+x

localhost/test.php

安装mariadb

┌──(kele㉿Roonready)-[/]
└─$ sudo apt-cache policy mariadb-server mariadb-client
mariadb-server:
  已安装:(无)
  候选: 1:10.6.8-1
  版本列表:     1:10.6.8-1 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages
mariadb-client:
  已安装:(无)
  候选: 1:10.6.8-1
  版本列表:     1:10.6.8-1 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages

┌──(kele㉿Roonready)-[/]
└─$ sudo apt install mariadb-server mariadb-client

//启动 mysql

┌──(kele㉿Roonready)-[/]
└─$ sudo systemctl start mariadb.service 

┌──(kele㉿Roonready)-[/]
└─$ sudo mysql                          
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32Server version: 10.6.8-MariaDB-1 Debian buildd-unstable

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

安装PHP Mysql扩展连接数据库

┌──(kele㉿Roonready)-[/]
└─$ sudo apt-cache policy php8.1-mysql 
php8.1-mysql:
  已安装:(无)
  候选: 8.1.5-1+b1
  版本列表:     8.1.5-1+b1 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages

┌──(kele㉿Roonready)-[/]
└─$ sudo apt install php8.1-mysql 

┌──(kele㉿Roonready)-[/]
└─$ sudo nano /home/music/mysql.php


标签: HIFILinux

相关文章

正确看待音响器材的测试数据

正确看待音响器材的测试数据

如果懒得看长文,记住一个最基本的道理即可:用仪器测试音响器材,用的是简单的正弦波信号(THD等测试),而真正播放音乐是高度动态变化的,而功放/耳放所驱动的音箱、耳机,从阻抗到低频响应特性等等都是具有极大差别。所以唯数据论是很低级的行为,特别是某些人更幼稚到把THD失真数据来做音箱器材声音水平的“排名...

Audiophile Linux安装

If you are for example going to use “/dev/sda” disk to create partition for AP-Linux, execute this commands:# fdisk /dev/sda or# cfdisk /dev/sda#...

Linux 语言环境管理命令 locale

修改设置locale 1、可以修改/etc/profile文件 修改/etc/profile文件,在最下面增加 export LC_ALL=zh_CN.utf8 export.utf8 命令行中使用命令source 配置文件 使其生效 2、修改/...

ARM系列主板安装moOde等数播系统

ARM系列主板安装moOde等数播系统 ver:1.0.3 by:Androidnews 2024.08.18 说明: 本安装教程不保证所有arm主板都能安装成功; 本安装教程虽然劲量简单,但是还是需要一定的Linux功底; 本安装教程以Debian的bookworm为基底实现,如...

Linux安装配置Zerotier客户端

1、在线安装└─$ curl -s https://install.zerotier.com/ | sudo bash...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。