Ubuntu 13.04搭建LNMP(Linux+Nginx+MySQL+PHP)网站服务器架构
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 最近一直在倒腾Wordpress网站,所以要在Linux服务器上搭建LNMP环境,每次换服务器都要重新安装各种服务麻烦不说还浪费很多时间,虽然有LNMP的集成安装包,对于我的机器来说我觉得实在是太慢了,安装
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入
最近一直在倒腾Wordpress网站,所以要在Linux服务器上搭建LNMP环境,每次换服务器都要重新安装各种服务麻烦不说还浪费很多时间,虽然有LNMP的集成安装包,对于我的机器来说我觉得实在是太慢了,安装一个LNMP可能要一两个小时,也不太可取,所以就想写个安装文档,为以后在虚拟机上部署节省时间。在写LNMP之前我还想说说最近使用阿里云ECS和京东云擎的一些感受:试用了阿里云的云服务器 ECS并部署Wordpress网站,总的来说ECS还是非常稳定的,速度也可以,独立IP地址,唯一的缺点就是价格有点偏高,对于我这种玩博客的穷人,我觉得还是买个虚拟主机玩玩就行了。
京东云擎还可以,免费而且速度还可以,不过对上传包的大小都有限制。apache、tomcat、nginx等web应用服务器。在云计算的定义里,它就是一台已经安装好、各种参数已经配置好,等待你一键启用的应用服务器。它可以根据用户的需求,创建多个实例,以满足海量用户访问,也可以减少实例创建,降低你的硬件成本。SO 这就是京东云应用引擎,像云一样动态扩展收缩,并按实际使用收费(目前还免费中
言归正传,搭建了LNMP(Linux+Nginx+MySQL+PHP)网站服务器架构,服务器为阿里云服务器,系统为ubuntu13.04 64位。
第零步:创建一个新的用户
使用一个非 root 的用户,更不容易犯错误,所以首先我们先创建一个普通用户 aliyun
并且设定新用户的密码。
# useradd -s /bin/bash -m -d /home/aliyun aliyun
# passwd aliyun
然后再 sudo 文件中加入这个用户:
1 #vi /etc/sudoers
加入一行新的记录:
1 aliyun ALL=(ALL:ALL) ALL
第一步:安装软件
首先更新 ubuntu 的软件包安装源:
1 $ sudo apt-get update
1. 安装 nginx 很简单,直接输入命令:
1 $ sudo apt-get install nginx
2. 安装 mysql,同样很简单:
1 $ sudo apt-get install mysql-client-5.5 mysql-server-5.5
?
安装过程中,会让你输入 root 的密码,并且确认。
3. 安装 php-fpm,因为 wordpress 是 php,我们使用 php-fpm 来驱动,需要安装的软
件包较多,但是都在一个命令中搞定
1 $ sudo apt-get install php5 php5-fpm php5-cli php5-cgi php5-mysql php5-gd
4. 下载 wordpress 中文版,并且解压在/home/aliyun 目录下:
$ wget http://cn.wordpress.org/wordpress-3.9-zh_CN.zip
$ unzip wordpress-3.9-zh_CN.zip
?
如果提示没有 unzip,用 sudo apt-get install unzip 安装一下。
第二步:配置软件
1. 在 mysql 中创建 wordpress 数据库,并且创建一个新的 aliyun 用户,并将 wordpress
数据库授权给 aliyun 这个用户:
1 $ mysql ?uroot ?p
输入密码,后创建数据库:
mysql> create database wordpress character set utf8;
mysql> grant all privileges wordpress.* to aliyun@localhost identified by
'passwd';
注意这里 passwd 是用你自己的密码串去替代。
2. 修改 wordpress 的配置文件
首先,拷贝一份 wordpress 的配置文件:
$ cd /home/aliyun/wordpress
$ cp wp-config-sample.php wp-config.php
然后用 vi 打开配置文件,将数据库的地址、名称、用户名、密码填入:
define('DB_NAME', 'wordpress');
define('DB_USER', 'aliyun');
define('DB_PASSWORD', '刚刚创建的密码');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
同时, 紧接着数据库配置后面, 点击开配置文件中生成 session 随机密钥的地址,并将将生
成的密钥拷贝替换掉配置文件中的 8 行配置:
[1] [2]

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



It is a very common problem these days that Ubuntu does not allow its users to open the terminal. If you receive a similar issue and don’t know what to do next, learn about five fixes on how to resolve this “Ubuntu cannot open terminal” issue on your Linux device. Without further ado, let’s dive into what causes it and the solutions available to it. Why can't Ubuntu open the terminal on it? This mainly happens when you install some defective software or modify the terminal configuration. In addition to this, new applications or games that interact with locales and corrupt them can cause similar problems. Some users reported a fix for this issue when searching for Terminal in Ubuntu's activity menu. This shows that

In the Ubuntu system, we often encounter folders with a lock shape on the top. This file often cannot be edited or moved. This is because there is no permission to edit the file, so we need to modify its permissions. How to remove the lock in the lower right corner? Let’s take a look at the detailed tutorial below. 1. Right-click on the locked folder--Properties. 2. Select the permissions option in the window. 3. Select everything inside to create and delete files. 4. Then select Change the permissions of the included files at the bottom, which are also set to create and delete files. Finally, remember to click Change in the upper right corner. 5. If the above lock is still not removed, or the options are grayed out and cannot be operated, you can right-click inside - open the terminal. 6. make

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

There are many software icons listed in the Ubuntu system start menu. There are many uncommon icons. If you want to delete them, how should you delete them? Let’s take a look at the detailed tutorial below. 1. First enter the ubuntu desktop and click on the start menu under the left panel. 2. You can find a text editor icon inside, we need to delete it. 3. Now we return to the desktop and right-click the mouse to open the terminal. 4. Use the command to open the application list directory. sudonautilus/usr/share/applicationssudonautilus~/.local/share/applications5. Find the corresponding text editor icon inside. 6. Then go straight

Ubuntu24.04LTS, codenamed "NobleNumbat" will be released soon! If you are using a non-LTS version such as Ubuntu 23.10, sooner or later you will need to consider upgrading. For those using Ubuntu20.04LTS or Ubuntu22.04LTS, it is worth thinking about whether to upgrade. Canonical has announced that Ubuntu 24.04LTS will provide update support for up to 12 years, broken down as follows: As an LTS version, it will have 5 years of regular maintenance and security updates. If you subscribe to Ubuntu Pro, you can enjoy an additional 5 years of support. Currently, this additional support period has been extended to 7 years, which means you will get up to 12

OBS is open source software developed by volunteer contributors around the world in their free time. A video live recording software, mainly used for video recording and live streaming. Please note that when installing Ubuntu/Mint, OBSStudio cannot fully work on ChromeOS, and functions such as screen and window capture cannot be used. It is recommended to use xserver-xorg1.18.4 or newer version to avoid potential performance issues with certain features in OBS, such as full-screen projectors. FFmpeg is required. If you don't have FFmpeg installed (if you're not sure, you probably don't), you can get it with: sudoaptinstallffmpeg I already have it installed here

snap is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel and systemdinit system. These packages, known as snaps, and the tool that uses them, snapd, are available across a range of Linux distributions and allow upstream software developers to publish their applications directly to users. With snap, users can easily install Linux applications. By default, snapd will check for updates four times a day and automatically update snap applications to the latest version. While there are many ways to control when and how often updates are installed, users cannot completely turn off automatic updates for security reasons. Although the original intention of snap is good, many people use it to

Angular.js is a freely accessible JavaScript platform for creating dynamic applications. It allows you to express various aspects of your application quickly and clearly by extending the syntax of HTML as a template language. Angular.js provides a range of tools to help you write, update and test your code. Additionally, it provides many features such as routing and form management. This guide will discuss how to install Angular on Ubuntu24. First, you need to install Node.js. Node.js is a JavaScript running environment based on the ChromeV8 engine that allows you to run JavaScript code on the server side. To be in Ub
