openresty依赖于perl 5.6.1+, libreadline, libpcre, libssl,首先安装依赖关系。
yum install readline-devel pcre-devel openssl-devel gcc
使用wget下载
wget https://openresty.org/download/ngx_openresty-1.9.7.1.tar.gz
博主安装时最新版为1.9.7.1,可以登录http://openresty.org查看最新版本,选择需要的版本进行下载。
解压下载好的压缩包
tar xzvf ngx_openresty-1.9.7.1.tar.gz
注意将1.9.7.1替换为你下载的版本号
进入 ngx_openresty-VERSION/ 目录, 然后输入以下命令配置:
./configure
默认, –prefix=/usr/local/openresty 程序会被安装到/usr/local/openresty目录。
我们可以指定各种选项,比如
./configure --prefix=/opt/openresty \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-http_postgres_module
具体用法参考./configure –help 或者官方文档
使用make编译
make
安装
make install
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
/usr/local/openresty/nginx/html
nginx -c /usr/local/openresty/nginx/conf/nginx.conf //启动并加载配置文件
nginx -s stop //停止
nginx -s reload //重启
yum install mariadb mariadb-server net-tools
systemctl enable mariadb.service
systemctl start mariadb.service
mysql_secure_installation
接下来屏幕会出现一系列代码,代码及操作记录如下
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):<– 回车
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] <– y 回车
New password: <– 设置用户名为root的mysql密码
Re-enter new password: <– 密码确认
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <– y 回车
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <– y 回车
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <– y 回车
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <– y 回车
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
至此,mariaDB设置完毕
systemctl start mariadb.service
yum install php-fpm php-cli php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-memcache php-pear php-mbstring php-xml php-xmlrpc php-mbstring php-snmp php-soap
systemctl enable php-fpm.service
systemctl start php-fpm.service
配置文件为/usr/local/openresty/nginx/conf/nginx.conf
将其中php配置项注释去掉
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak #备份原有配置文件
vi /etc/php-fpm.d/www.conf #编辑
user = nginx #修改用户为nginx
group = nginx #修改组为nginx
:wq #保存退出
systemctl start php-fpm.service //启动
systemctl restart php-fpm.service //重启
systemctl status php-fpm.service //查看状态