Kali配置LNMP环境

tomosak2年前Linux696

安装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

相关文章

nginx网页服务器访问目录设置

编辑nginx.conf文件,在http段添加下面代码:autoindex on; autoindex_exact_size on; autoindex_localtime on; charset utf-8,gbk;...

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安装RoonServer

Audiophile音乐Linux为蓝本介绍安装RoonServer1、使用工具上传roonserver-installer-linuxx64_Roon_100800795.sh和RoonServer_linuxx64.tar.bz2两个文件到tmp目录2、进入etc目录,编辑hostsnano /...

moOdeAudio树莓派播放器开通ssh客户端登录

1、登录moOde系统,进入设置,找到Security,Web SSH设置为On,保存。2、点击open,打开web shh3、sudo -i 进入root模式4、使用下面命令systemctl enable ssh.servicesystemct start ssh.service...

Archlinux安装samba过程

1.安装Sambapacman -S samba2.编辑/etc/samba/smb.conf[global] workgroup=WORKGROUP server string=Samba Server %v netbios nam...

彻底删除.user.ini文件的方法

.user.ini是干什么的?其实这个文件是军哥LNMP一键包中的文件,根据军哥的官方解释:LNMP 1.2及更高版本防跨目录功能使用.user.ini,该文件在网站根目录下,可以修改.user.ini 里面的open_basedir的值来设置限制访问的目录或删除来移除防跨目录的设置。怎么删除?其实...

发表评论    

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