Linux装好后从无到有搭建一个WordPress
2023-04-18 14:39:25 时间
1、创建用户:
useradd -m -s /bin/bash yangyan
修改用户的密码
passwd yangyan
2、安装nginx:
sudo apt-get install nginx;
3、在用户下面建立存放网页的目录,名称为wwwroot
mkdir /home/yangyan/wwwroot
4、配置nginx和域名
vim /etc/nginx/sites-avaliable/default
修改root值为 /home/yangyan/wwwroot;
修改server_name的值为使用的域名;
修改index的值为 index.php; 表示我们默认的首页名字叫index.php;
5、安装php运行环境
apt-get install php5-cli php5-cgi php5-fpm php5-curl php5-gd php5-mcrypt php5-mysql php5-memcache php5-memcached php5-dev php-apc
配置nginx解析php的使用fastcgi处理,编辑/etc/nginx/sites-avaliable/default 文件,在server块中php处理写为:
location ~ .php$ {
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
其中fastcgi-php.conf文件内容为:
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
其中fastcgi.conf文件的内容为:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
6、安装mysql数据库
apt-get install mysql-server
7、安装wordpress
我可以先给wwwroot目录下面放一个php文件,只有一行代码,测试一下php的运行环境是否已经建立完成了;
建立一个文件1.php 放置到wwwroot目录下,内容为<?php phpinfo()?>,然后访问看能否将php的信息输出出来。
下载和安装wordpress具体细节就省略了,就是在wordpress网站下载好压缩包,解压到wwwroot目录中去;然后打开地址根据页面的向导填写数据库的连接参数,一路下一步就好了。
相关文章
- 【技术种草】cdn+轻量服务器+hugo=让博客“云原生”一下
- CLB运维&运营最佳实践 ---访问日志大洞察
- vnc方式登陆服务器
- 轻松学排序算法:眼睛直观感受几种常用排序算法
- 十二个经典的大数据项目
- 为什么使用 CDN 内容分发网络?
- 大数据——大数据默认端口号列表
- Weld 1.1.5.Final,JSR-299 的框架
- JavaFX 2012:彻底开源
- 提升as3程序性能的十大要点
- 通过凸面几何学进行独立于边际的在线多类学习
- 利用行动影响的规律性和部分已知的模型进行离线强化学习
- ModelLight:基于模型的交通信号控制的元强化学习
- 浅谈Visual Source Safe项目分支
- 基于先验知识的递归卡尔曼滤波的代理人联合状态和输入估计
- 结合网络结构和非线性恢复来提高声誉评估的性能
- 最佳实践丨云开发CloudBase多环境管理实践
- TimeVAE:用于生成多变量时间序列的变异自动编码器
- 具有线性阈值激活的神经网络:结构和算法
- 内网渗透之横向移动 -- 从域外向域内进行密码喷洒攻击