Linode(Ubuntu 14.04 LTS)安装WordPress备忘

主机选择

Ubuntu 14.04 LTS

登录主机

ssh root@xx.xx.xx.xx

操作系统升级

apt-get update 操作系统升级
apt-get upgrade 软件升级
apt-get autoremove 删除升级包

设置主机时区

dpkg-reconfigure tzdata

设置主机名

vim /etc/hosts
xx.xx.xx.xx hostname.example.com hostname
vim /etc/hostmane
hostname.example.com
hostname -F /etc/hostname 更新主机名

绑定域名

**

创建新的主机用户

adduser username
usermod -a -G sudo username
logout

安装Nginx

sudo add-apt-repository ppa:rtcamp/nginx -y
sudo apt-get update
sudo apt-get install nginx-custom -y
至此可以尝试打开下网站看看

配置Nginx(1/3)

vim /etc/nginx/nginx.conf

user www-data; www-data 修改为主机登录用户名
worker_processes 4; _进程数
client_max_body_size 8m; _ 增加设置上传文件大小

sudo nginx -t 检测配置信息准确性
sudo service nginx restart 重启Nginx服务器

创建虚拟目录

在用户根目录下创建同名站点文件夹
mkdir ~/example.com
mkdir ~/example.com/logs
mkdir ~/example.com/public

配置Nginx(2/3)

../nginx/sites-available目录创建同名服务器配置信息
cd /etc/nginx/sites-available
sudo vim example.com 加入server配置信息,尤其是路径信息;配置信息如下:

server {
    server_name example.com www.example.com;

    access_log /home/daodao/example.com/logs/access.log;
    error_log /home/daodao/example.com/logs/error.log;

    root /home/daodao/example.com/public/;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args; 
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

建立软连接../sites-available和../sites-enabled,类似于快捷键方式关联
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com

配置Nginx(3/3)

sudo nginx -t
sudo service nginx restart

安装PHP

sudo apt-get install php5-fpm php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-imagick php5-cli php-pear php5-dev php5-imap php5-mcrypt

配置PHP

vim /etc/php5/fpm/pool.d/www.conf

user = www-data // 将www-data修改为登录名
group = www-data
listen.owner = www-data
listen.group = www-data

vim /etc/php5/fpm/php.ini

post_max_size = 8M
upload_max_filesize = 8M

sudo php5-fpm -t

安装MySQL

sudo apt-get install mysql-server
sudo mysql_install_db
sudo mysql_secure_installation

创建MySQL数据库

mysql -u root -p

> CREATE DATABASE example_com;
> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON example_com.* TO ‘username'@'localhost';
> GRANT SELECT, INSERT, UPDATE, DELETE ON example_com.* TO 'username'@'localhost';
> FLUSH PRIVILEGES;
> exit;

安装wordpress

参考阅读

    原文作者:盗盗
    原文地址: https://segmentfault.com/a/1190000004273636
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞