Ubuntu LNMP

安装软件


apt upgrade
apt remove apache2
apt install nginx
apt install mysql-server
apt install php8.3
apt install php8.3-fpm
apt install php8.3-mysql
apt install php8.3-curl
apt install php8.3-common 
apt install php8.3-cli

配置Nginx

vi /etc/nginx/sites-enabled/default

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		index index.html;
		# 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/php-fpm.sock;
		# With php-cgi (or other tcp sockets):
		#fastcgi_pass 127.0.0.1:9000;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#	deny all;
	#}
}

测试网页

cd /var/www/html/
vi test.php

<?php
phpinfo();
?>

访问ip/test.php

wordpress

root@u1:~# mysql -uroot -p
 
Enter password:
 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
 
Your MariaDB connection id is 36
 
Server version: 10.3.39-MariaDB-0ubuntu0.20.04.2 Ubuntu 20.04
 
 
 
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)]>
 
MariaDB [(none)]> create database wordpress default character set utf8 collate utf8_unicode_ci;
 
Query OK, 0 rows affected (0.001 sec)
 
 
 
MariaDB [(none)]> create user 'wp'@'localhost' identified by 'wp';
 
Query OK, 0 rows affected (0.001 sec)
 
 
 
MariaDB [(none)]> grant all privileges on *.* to 'wp'@'localhost';
 
Query OK, 0 rows affected (0.000 sec)
 
 
 
MariaDB [(none)]> flush privileges;
 
Query OK, 0 rows affected (0.000 sec)
 
 
 
MariaDB [(none)]> exit

下载worpress

curl -O https://wordpress.org/latest.tar.gz
 
tar -xzvf latest.tar.gz

cp ./wordpress/wp-config-sample.php ./wordpress/wp-config.php
mkdir ./wordpress/wp-content/upgrade
cp -a ./wordpress/* /var/ww/html/wordpress
vim /usr/share/nginx/html/wp-config.php
dbname wordpress
dbuser wp
passwd wp
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值