http://php.net/manual/zh/install.windows.php

https://www.unixmen.com/install-wordpress-centos-7-linux/  (Very useful)

https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp (Very useful)

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-7

https://www.tipsandtricks-hq.com/how-to-uninstall-and-reinstall-wordpress-245  (update wp-config.php and then go to wp-admin/install.php page)

https://codex.wordpress.org/Using_Themes#Get_New_Themes

https://www.tipsandtricks-hq.com/how-to-fix-the-unable-to-create-directory-error-in-wordpress-5264 (this happend, and might also related to faliure to install themes online)

https://httpd.apache.org/docs/2.2/vhosts/examples.html

下载中文版: https://cn.wordpress.org/

To check whether PHP got installed on your machine:

# rmp -qa | grep -i php    (looks it looking for installed packages containing "php")

Or

# locate php  (looks like it's searching files with name containing "php" )

#Install Apache on CentOS
sudo yum -y install httpd sudo systemctl start httpd sudo systemctl enable httpd #Test Apache and use browser to check the default website by apache
sudo systemctl status httpd #installing MySql/MariaDB
sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation

#install PHP
sudo yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl

#install Wordpress
sudo yum install zip unzip
sudo wget https://wordpress.org/latest.zip

sudo unzip latest.zip
sudo cp -avr wordpress /var/www/html
sudo chmod -R 775 wordpress
sudo chown apache:apache wordpress

Quetions:

PHP configuratioin files?

Apache configuration files?
Answer:  /etc/httpd/conf/httpd.conf

How to host multiple websites on apache in centos?

https://www.mysysadmintips.com/linux/servers/586-host-multiple-websites-on-apache-in-centos

This tutorial shows how to setup Apache Virtual Hosts in CentOS 7. This is useful if you want to host more than one website on a single CentOS web server. For instructions on how to setup Apache, PHP, and SQL database on CentOS 7, check this article.

Setup folder structure for your websites

We are going to create 2 folders for each website. The first will hold HTML and other content, second - log files.

/var/www/sites/domain1/html
/var/log/httpd/domain1

/var/www/sites/domain2/html
/var/log/httpd/domain2

/var/www/sites/domain3/html
/var/log/httpd/domain3

Log files will be stored in var/log/httpd/... subfolders, which is the default place to store log files in Linux. People often store Apache log files in /var/www/ subfolders, but in CentOS with SELinux enabled this can cause access denied errors. This can be fixed with chcon command, but I prefer to store all my log files in /var/logs...

You can also place index.html files with some sample text in each html directory which we'll use later for testing.

Create folder structure for virtual host files

Create folders:

/etc/httpd/sites-available
/etc/httpd/sites-enabled

sites-available will hold virtual host config files for websites that are configured, but not necessary enabled. These files are actually ignored when Apache starts, but this system allows to easily disable and enable websites without having to delete or create new virtual host files every time we want to take a site offline and put it back online.

sites-enabled will hold symbolic links to virtual host files inside sites-available that are enabled. They will be loaded when Apache starts.

Add sites-enabled to Apache config

Open file /etc/httpd/conf/httpd.conf and at the very end of the file add following text:

IncludeOptional sites-enabled/*.conf

This will tell Apache to look for virtual host files with extension .conf in sites-enabled directory.

Create Virtual Host files

In directory /etc/httpd/sites-available create config files for each website (domain1.conf, domain2.conf, etc.) with following content:

<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com
DocumentRoot /var/www/sites/domain1/html
ErrorLog /var/log/httpd/domain1/error.log
CustomLog /var/log/httpd/domain1/access.log combined
</VirtualHost>

Change domain1 to match your domain names and directories you created previously.

If Apache can't match the requested domain to any of the virtual hosts, the first (alphabetically) virtual host site will be loaded. If you want to have more control over this, you can create a dedicated virtual host (i.e. 00_default) that will be loaded only when no matching virtual host exist. ServerName and ServerAlias should not match any of your domains (i.e. example.com) The name starts with 00 so that it is always the first virtual hosts alphabetically. The site linked to this default virtual host could show an error message, redirect to another domain, etc.

Edit httpd.conf

Edit the main Apache configuration file /etc/httpd/conf/httpd.conf according to your requirements.

In my particular case, I made following changes:

Set webmaster email address:
ServerAdmin administrator@domain.com

Set main document root:
DocumentRoot "/var/www/sites"

Configure main document root:
<Directory "/var/www/sites">
AllowOverride All
Options FollowSymLinks
</Directory>

AllowOverride All - is required if you intend to use .htaccess files for directory level configuration. By default, this is set to None, in which case .htaccess overrides would be ignored.
Options -Indexes - prevents directory listing.

Enable Virtual Hosts

To enable websites, we need to create symbolic links in /etc/httpd/sites-enabled pointing to appropriate config files in sites-available. To do this, run:

ln -s /etc/httpd/sites-available/domain1.conf /etc/httpd/sites-enabled/domain1.conf

For changes to take effect we need to restart Apache:

systemctl restart httpd.service

To disable a particular website, simply delete relevant symbolic link (or change the extension) and restart Apache.

Before going live, you can test if everything is working locally. To do this, edit the hosts file on your client machine to point domains configured inside virtual hosts to the CentOS web server's IP address. If everything was setup properly, pointing your web browser to one of the domains should load index.html file from an appropriate /var/www/sites/... directory.

2015.01
CentOS 7


以下为最近学习小结:

问题一: 创建新用户并设置密码
解决方案:
创建新用户 adduser <username>
设置密码 passwd <username>

问题二:使用新用户登录,执行 "sudo yum update",没有sudo 权限,得到错误: “<user> is not in the sudoers file. This incident will be reported.”
解决方案:http://www.cnblogs.com/evasnowind/archive/2011/02/04/1949113.html
一、$whereis sudoers -------找出文件所在的位置,默认都是/etc/sudoers
二、 #chmod u+w /etc/sudoers 以超级用户登录su -root ,修改文件权限即添加文件拥有这的写权限 限,ls -al /etc/sudoers 可以查看原文件的权限。
三、vim /etc/sudoers 编辑文件,在root ALL=(ALL)ALL行下添加XXX ALL=(ALL)ALL,XXX为你的用户名。添加方法:找到root行,按下”i“键进入编辑模式添加即可!编辑好后esc键进入一般模式,“:wq"保存退出!
最后, #chmod u-w /etc/sudoers 回到文件的原权限!

问题三: 没有安装VIM
解决方案: # yum -y install vim*

操作4: Install MySQL on CentOS-7
https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7

操作5: 本机登录mysql创建帐户、密码及新的数据库
> mysql -u root
> create user '<username>'@'%';
> SET Password for '<username>'@'%' = Password('mypassword');
此时该用户已经可以远程登录了!

TODO: set password for mysql for root account.

> create database <db-name>;
> grant all privileges on <dbname>.* to '<user>'@'localhost';

> select current_user();

到此,数据库、连接用户名密码已经配置完成!

操作6:尝试直接使用IP或域名访问此服务器

[slin@iZwz9h33t7dnsizrtbp8yhZ www]$ wget http://www.linsw.com
--2017-06-14 10:52:14-- http://www.linsw.com/
Resolving www.linsw.com (www.linsw.com)... 120.77.38.243
Connecting to www.linsw.com (www.linsw.com)|120.77.38.243|:80... failed: Connection refused.

操作6-1: 尝试安装nodejs, 分别使用80与非80端口,来看一下服务器上的nodejs能否正常工作
> sudo yum install nodejs

准备以下内容给 nodetest /index.js文件:
var port = (process.env.port || 8080);
if (process.argv.length > 2) {
for (var i = 2; i < process.argv.length; i++) {
console.log(process.argv[i]);
var m = /port=(\d+)/.exec(process.argv[i]);
if (m) {
port = m[1];
}
}
}

var http = require('http');

var server = http.createServer(function(req, res, next){
console.log('got request:' + req.url);
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('hello world from shawn. NodeJS');
});

/*server.on('listen', function(){
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
console.log(bind);
});
*/

var port = 80;
server.listen(port);

server.on('error', function(err){
console.log(err);
});

console.log('server is listening on port: ' + port);

> sudo nodejs ~/www/nodetest/index.js
说明機器上沒有别的进程在使用80端口;那接下来应该需要安装apache httpd服务。

操作7:安装apache, php
http://www.cnblogs.com/swlin/p/PHP.html

> sudo yum -y install httpd
> sudo systemctl enable httpd
> sudo systemctl start httpd
至此,httpd服务成功安装,并可以通过域名成功访问,并显示一个默认的测试页面。
> sudo systemctl status httpd

操作7-2:
#install PHP
sudo yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl

#install Wordpress
sudo yum install zip unzip
sudo wget https://wordpress.org/latest.zip

sudo unzip latest.zip

sudo mkdir /var/www/websites/
sudo cp -avr wordpress /var/www/websites/mywebsite
sudo chmod -R 775 mywebsite
sudo chown apache:apache mywebsite

操作8: rewrite module
打开httpd.conf(在那里? APACHE目录的CONF目录里面),用文本编纂器打开后,查找
(1)
Options FollowSymLinks
AllowOverride None

改为
Options FollowSymLinks
AllowOverride All

(2)去掉下面的注释
LoadModule rewrite_module modules/mod_rewrite.so

(3) 修改文件 /etc/httpd/virutal_hosts/<your-host-file>.conf,在<VirtualHost *:80>节点里面增加如下内容

<Directory /var/www/websites/dev_gmpflex_com>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

操作9:解决wordpress安装主题时一直提示需要FTP用户名及密码,其它完全不需要安装 FTP SERVER的:
解决方案:
http://jingyan.baidu.com/article/4f34706efc1237e387b56da4.html

第一,如果我们安装的是lnmp一键安装包,那可以使用。授权组来解决。

chown -R 775 /home/wwwroot/my-website-name(修改成网站域名目录)

第二,如果是其他的可以使用在wp-config.php文件中添加脚本方式。
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);

上述脚本添加到文件最后面就可以。

但是,之后我又遇到问题: 安装失败,无法创建目录。
操作9-1: chmod -R 777 /var/www/ (这个搞定问题,但不知道直接到本人使用的/var/www/websites/行不行?)

=================
centos new user: slin/ABcd1234

如果您的.htaccess文件可写,我们即会自动帮您完成,但其目前不可写,所以以下是您需要加入您的.htaccess文件中的mod_rewrite规则。点击文本框并按CTRL + a来全选。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

http://blog.sina.com.cn/s/blog_6452c6b40100qr7m.html

PHP on CentOS (LAMP) and wordpress的更多相关文章

  1. centos lamp/lnmp阶段复习 以后搬迁discuz论坛不需要重新安装,只需修改配置文件即可 安装wordpress 安装phpmyadmin 定时备份mysql两种方法 第二十五节课

    centos  lamp/lnmp阶段复习 以后搬迁discuz论坛不需要重新安装,只需修改配置文件即可 安装wordpress  安装phpmyadmin  定时备份mysql两种方法  第二十五节 ...

  2. Centos 7使用docker部署LAMP搭建wordpress博客系统

    0.简要概述 LAMP是目前比较流行的web框架,即Linux+Apache+Mysql+PHP的网站架构方案.docker是目前非常流行的虚拟化应用容器,可以为任何应用创建一个轻量级.可移植的容器. ...

  3. LAMP 搭建wordpress部署教程贴.

    LAMP 搭建wordpress部署教程贴.这是一篇主要将LAMP,并且通过wordpress来进行验证,演示.如何去部署PHP CMS很多新手看到LAMP就很很头大,觉得很难搞,编译安装,搞了好几天 ...

  4. LAMP 建立 Wordpress 站点 Linux Apache MariaDB PHP

    使用LAMP建立Wordpress, 要求如下: 准备工作: VMware 14 CentOS 7.4 最小化 安装镜像 Wordpress 安装包,  下载 预热: 使用VMware新建4台虚拟机, ...

  5. 于CentOS 6 安装 Wordpress

    1.两种方式给Wordpress 首先,你可以去wordpress最新的官方网站看看wordpress多少下载.例wordpress 3.9.1下载地址: http://cn.wordpress.or ...

  6. LVS之-LAMP搭建wordpress

    author:JevonWei 版权声明:原创作品 LVS搭建wordpress,涉及的知识点有DNS,LAMP,NFS及LVS 网络拓扑图 网络环境 NFS 192.168.198.130 mysq ...

  7. 【简书】在阿里云自带的CentOS + LAMP环境下部署一个Laravel项目

    在阿里云自带的CentOS + LAMP环境下部署一个Laravel项目 作者 DonnieZero 关注 2017.07.29 22:02* 字数 2218 阅读 5556评论 3喜欢 1赞赏 1 ...

  8. 实战!基于lamp安装wordpress详解-技术流ken

    简介 LAMP 是Linux Apache MySQL PHP的简写,其实就是把Apache, MySQL以及PHP安装在Linux系统上,组成一个环境来运行动态的脚本文件.现在基于lamp搭建wor ...

  9. centos LAMP第四部分mysql操作 忘记root密码 skip-innodb 配置慢查询日志 mysql常用操作 mysql常用操作 mysql备份与恢复 第二十二节课

    centos  LAMP第四部分mysql操作  忘记root密码  skip-innodb 配置慢查询日志 mysql常用操作  mysql常用操作 mysql备份与恢复   第二十二节课 mysq ...

随机推荐

  1. SQLSERVER性能调优小技巧

    平时做个记录,在工作过程中针对大数据查询的一些小技巧 -----------SELECT------------- 1.必要的冗余字段,减少关联查询 2.关键查询字段必须加索引 否则百万级以上你就别想 ...

  2. Caffe 分类问题 Check failed: error == cudaSuccess (2 vs. 0) out of memory

    如果图片过大,需要适当缩小batch_size的值,否则使用GPU时可能超出其缓存大小而报错

  3. hive建表报错:Specified key was too long; max key length is 767 bytes,hadoophive

    情况描述 Hive建表时报错,元数据存储在mysql中. 报错信息 如下: FAILED: Execution Error, bytes com.mysql.jdbc.exceptions.jdbc4 ...

  4. SAP Parallel Accounting(平行分类账)业务配置及操作手册

    目录 SAP Parallel Accounting(平行分类账业务)配置及操作手册 SAP Parallel Accounting(平行分类账业务)配置及操作手册 Overview 业务说明 为了适 ...

  5. Win2003打开网页时总是提示添加网址到信任站点的设置方法

    在WIN2003系统中,我们打开网页,或打开网站,或浏览网页时,老是跳出一个窗口提示“添加网址到信任站点”,“网页老是提示添加信任”或“2003每打开一次网页都要加入受信任站点”或“win2003提示 ...

  6. 【深入Java虚拟机】一 JVM类加载过程

    首先Throws(抛出)几个自己学习过程中一直疑惑的问题: 1.什么是类加载?什么时候进行类加载? 2.什么是类初始化?什么时候进行类初始化? 3.什么时候会为变量分配内存? 4.什么时候会为变量赋默 ...

  7. OpenGL矩阵变换,坐标空间变换

  8. 虚拟机---vmmare15安装centos7.4

    第一步:下载centos7的镜像iso文件:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Everything- ...

  9. [Codis] Codis3部署流程

    #0 前言 最近因为项目需要,研究了一下传说中的Codis.下面跟大家分享Codis3的搭建流程 https://github.com/CodisLabs/codis #1 Codis是什么 官方的介 ...

  10. phpadmin dvwa sqli-labs xsser.me

    下载phpadmin,安装后网站根目录 phpStudy\PHPTutorial\WWW 将下载的dvwa文件夹放到该目录下,修改config/config.inc.php文件中的mysql连接信息. ...