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
- 惹~

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.


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

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.