当前位置: 首页 > 工具软件 > OneinStack > 使用案例 >

linux卸载oneinstack,Linux服务器OneinStack安装工具

司雅畅
2023-12-01

生成软件包信息缓存

yum makecache

安装更新

yum update -y

安装必要软件

yum install -y zip unzip wget curl git vim zsh nano screen

安装oh my zsh(有助于补全和选择目录)

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - )"

搭建LNMP环境

//下载oneinstack安装包

wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz

//解压安装包

tar xzvf oneinstack-full.tar.gz

cd oneinstack

//执行安装脚本进行自动安装

./install.sh #注:请勿sh install.sh或者bash install.sh这样执行

安装选项选择

1.设置SSH端口(默认22),回车即可;

2.然后选择是否安装web,输入y;

3.输入1安装nginx;

4.输入3不安装Apache;

5.输入5不安装tomcat;

6.然后选择是否安装数据库database,输入y;

7.输入2安装mysql-5.7;

8.然后输入数据库root密码123456(注:妥善保管);

9.然后输入1选择从二进制安装;

10.然后输入y安装PHP;

11.输入5安装PHP7.0;

12.输入y安装php缓存插件DoyouwanttoinstalopcodecacheofthePHP?[y/n]:y;

13.输入1安装ZendOPcache;

14.输入n不安装ionCube;

15.输入n不安装ImageMagick;

16.输入n不安装Pure-FTPd;

17.输入y安装phpMyAdmin;

18.输入y安装redis;

19.输入n不安装memcached;

20.输入n不安装HHVM;

redis配置

配置redis密码

执行命令修改/usr/local/redis/etc/redis.conf文件,(也可以手动修改redis.conf文件)

echo requirepass redis的密码 >> /usr/local/redis/etc/redis.conf

重启redis

//注:serviceredis-serverrestart在centos7.x中不支持

systemctl restart redis-server

创建数据库

==使用oneinstack一键搭建中的phpMyAdmin插件==

vim /etc/my.cnf

//在my.cnf里面设置添加语句

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

访问 http://你的ip地址/phpMyAdmin/

web站点搭建

在oneinstack目录下添加虚拟机

cd ~/oneinstack

./vhost.sh

选项选择

1.选择1,UseHTTPOnly;

2.然后输入域名;

3.输入网站的文件目录,直接回车就行;

4.然后添加其他域名,有的话就输入y,没有就输入n;

5.是否添加防盗链,输入n;

Do you want to add hotlink protection? [y/n]: n

6.Allow Rewrite rule? [y/n]: y

Please input the rewrite of programme : wordpress,opencart,magento2,drupal,joomla,laravel,thinkphp,discuz,typecho,ecshop rewrite was exist.

(Default rewrite : other): thinkphp

7.输入y,开启日志

Allow Nginx/Tengine/OpenResty access_log? [y/n]: y

在oneinstack目录下删除虚拟机

vhost.sh del

Nginx thinkphp 静态化

1、修改/usr/local/nginx/conf/rewrite/thinkphp.conf

vim /usr/local/nginx/conf/rewrite/thinkphp.conf

//文件内容如下:

location / {

if (!-e$request_filename) {

rewrite ^(.*)$ /index.php?s=$1 last;

break;

}

}

//修改为:

location / {

if (!-e$request_filename) {

rewrite ^/([0-9]+)$ /index.php?m=Show&a=index&roomnum=$1 last;

#rewrite ^(.*)$ /index.php?s=$1 last;

rewrite ^(.*)$ /index.php?s=$1 last;

break;

}

}

2、然后创建pathinfo.conf文文件

touch /usr/local/nginx/conf/pathinfo.conf

vim /usr/local/nginx/conf/pathinfo.conf

//然后输入以下内容并保存

set $real_script_name $fastcgi_script_name;

if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {

set $real_script_name $1;

set $path_info $2;

}

fastcgi_param SCRIPT_FILENAME $document_root $real_script_name;

fastcgi_param SCRIPT_NAME $real_script_name;

fastcgi_param PATH_INFO $path_info;

3、然后编辑 /usr/local/nginx/conf/vhost/您的域名.conf 文件

vim /usr/local/nginx/conf/vhost/您的域名.conf

//编辑文件如下:

location ~\.php {

#fastcgi_pass remote_php_ip:9000;

fastcgi_pass unix:/dev/shm/php-cgi.sock;

fastcgi_index index.php;

#include fastcgi_params;

include fastcgi.conf;

}

//在include fastcgi.conf;下面面加入一句:

include pathinfo.conf;

然后修改/usr/local/php/etc/php.ini,搜索cgi.fix_pathinfo把值从0改成1;

vim /usr/local/php/etc/php.ini

cgi.fix_pathinfo=1

 类似资料: