直播源代码开发,Oneinstack 搭建web站点的简单说明

Linux服务器需要安装如MySQL数据库,Tomcat应用服务器,Nginx(web服务器),在国内提供的Linux Web安装脚本中,有面板的环境我们可能较多的会使用宝塔面板,但是在无面板的环境中会选择和使用军哥的LNMP,以及Oneinstack脚本,通常我们使用较多的是Oneinstack,那么下边就简单介绍下在直播源代码开发时,Oneinstack添加虚拟机的使用说明。

一、oneinstack目录下添加虚拟机

1、执行到到oneinstack目录下:
cd ~/oneinstack 
2、执行命令:
./vhost.sh
3、选择1:仅配置http
What Are You Doing?
	1. Use HTTP Only//仅配置http
	2. Use your own SSL Certificate and Key//自己购买ssl替换,自动配置http、https
	3. Use Let's Encrypt to Create SSL Certificate and Key//Let's免费证书,自动配置http、https
	q. Exit//退出
Please input the correct option: 1//此处选1
4、输入站点域名,即虚拟机主机域名
Please input domain(example: www.example.com): 此处输入域名
5、输入网站的根目录(绝对路径),可不填写直接回车即可
Please input the directory for the domain:test.meishaogirs.top :
(Default directory: /data/wwwroot/test.meishaogirs.top): 
6、是否添加其他域名或IP访问同一个网站根目录,有的话就输入 y ,没有就输入 n
Do you want to add more domain name? [y/n]: n
7、是否添加防盗链,一般设置不添加
Do you want to add hotlink protection? [y/n]: 此处输入n
8、是否设置伪静态
Allow Rewrite rule? [y/n]: y
9、手动输入伪静态规则名字,文件位置:/usr/local/nginx/conf/rewrite/输入的文件名称.conf
Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog rewrite was exist.
(Default rewrite: other): 输入文件名称
10、输入 y ,开启日志 
Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
以上虚拟机添加完成;

二、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.,去掉前面的分号。
 vim /usr/local/php/etc/php.ini cgi.fix_pathinfo=1 

三、部署直播程序

1.将代码包里面的web文件夹中的东西拷贝到网站根目录。
举例说明:
假设您的站点为: www.abc.com
mv /root/web/data/wwwroot/livenew.yunbaozb.com/* /data/wwwroot/www.abc.com/ 
改变读写权限 
chmod -R 775 /data/wwwroot/www.abc.com/ 
改变所属者和所属组 
chown -R www:www /data/wwwroot/www.abc.com

到此,虚拟机添加完成,配置对应的文件,重启命令即可访问。
以上就是在直播源代码开发时,Oneinstack添加虚拟机的使用说明,这对于后期直播APP的正常使用也是至关重要的,感兴趣可继续关注。
声明:本文由作者原创,转载请注明出处及原文链接。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值