VPS用LNMP装配WordPress
VPS用LNMP安装WordPress
前言
前几天,朋友手头上有一个空闲的vps,256M内存,我决定拿来玩一下。经过一番思考,还是用来挂站吧。然后看是CentOS6系统,果断决定用从来没玩过的LNMP。于是,百度、谷歌找教程,好多教程都是有问题的,导致重装无数次系统,浪费大把大把时间。现在总结一下成功的经验。
安装screen
在终端输入 yum install screen
完成后输入 screen -S lnmp
为什么要这样做呢?答案很简单,因为它可以保护您的远程连接,让工作不半路意外停止。我在安装LNMP的时候时间比较长,而XShell曾经莫名其妙断开,吓得我以为又要重新来过。还好一开始开了screen,进程还在。
如果您的终端在工作中意外断开,你可以输入screen –ls 来查看所有screen会话,然后输入screen –r + 代号 来恢复。
安装LNMP
在终端输入以下代码
wget -c http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz && tar zxf lnmp1.1-full.tar.gz && cd lnmp1.1-full && ./centos.sh
根据提示安装
这里要求输入MYSQL密码
然后输入这里需要确认是否启用MySQL InnoDB
选择php版本
选择mysql版本
我个人建议全部用最新的吧
漫长的等待。。。。。我用了三个小时。。。。。
大功告成
配置站点
环境装好了,如何让它可以挂站呢。
在终端输入 /root/vhost.sh
这里输入要绑定的域名,在这里,www.joycex.com和joycex.com不是同一个域名。建议在这里一起输入,两个域名间用空格间开。
如果你不小心打错了,用Ctrl+Backspace来删除,不要直接Backspace(这样子不会删除,反而出现^H)
回车后会出现如下提示
如果需要添加更多的域名,如不需要直接输入 n 回车。如需要输入 y 回车
接下来是设置网站目录位置,一般情况下不需要设置直接回车即可。
这里选择是否添加伪静态规则,如不需要伪静态,直接输入 n 回车。如果需要输入 y 回车,再选择伪静态或自定义伪静态
选择y就会出现以下提示
默认已经有了很多东西,可直接输入以上名称即可。
我们这里安装wordpress,直接输入wordpress就可以了。
下面是否选择开启日志
一般没什么用选择n
出现:Press any key to start create virtul host... 后,再次回车确认就会自动添加虚拟主机。
安装wordpress
鉴于用命令操作非常不方便,所有建议大家先下载到本地,然后用WinSCP这种SFTP软件上传到网站目录
首先去http://cn.wordpress.org/ 下载wordpress
用WinSCP上传
在浏览器输入http://域名/wp-admin/install.php
然后就进入了wordpress的经典安装界面,提示很简单,很容易安装
不到五分钟就大功告成了!
- 2楼薜定谔的朱朱
- 沙发!瓜子文章有很大长进哦!
- 1楼Allen Lee
- 惹~

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

The Dasung Paperlike Color with a screen diagonal of 12 inches is now available. The model, which was announceda few months ago,offers a very high resolution of 2,560 x 1,600 and therefore a high level of sharpness, particularly in view of its relati

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app
