编辑文件:
/etc/init.d/rc.local
将你开机需要自动执行的脚本,或者某些需要执行的代码执行写在文件后面即可。
脚本就直接填写:路径+文件名.sh
定时执行脚本:
编辑文件:
/etc/init.d/rc.local
将你开机需要自动执行的脚本,或者某些需要执行的代码执行写在文件后面即可。
脚本就直接填写:路径+文件名.sh
定时执行脚本:
linux centos ubuntu开机自动启动
系统需求
支持组件
1,安装依赖包
yum -y install wget screen unzip screen -S lamp
2,下载安装包
wget -O lamp.zip https://github.com/teddysun/lamp/archive/master.zip unzip lamp.zip cd lamp-master/ chmod +x *.sh
3,开始安装
./lamp.sh 2>&1 | tee lamp.log
安装的过程中选择你需要安装的选项即可,同时设置开机自动启动
chkconfig httpd on //apache开机自动启动 chkconfig mysqld on //mysql开机自动启动 关于chkconfig开机自动启动,要保证以上命令能使用就必须满足以下条件: 1.确保/etc/rc.d/init.d/mysqld 存在,可以使用service mysqld start能够正常启动 2.把mysqld托管给chkconfig:chkconfig --add mysqld 3.执行chkconfig mysqld on 4.查看是否设置成功:chkconfig --list mysqld 5.如果 0:off 1:off 2:on 3:on 4:on 5:on 6:off //2345都是on表示设置成功 6.如果没有成功手动设置一下:chkconfig --level 2345 mysqld on http://blog.csdn.net/chtdsl/article/details/8644788
4,安装其他php模块
下载包含所有安装包的源码(230MB)来安装 wget http://lamp.teddysun.com/lamp.tar.gz tar -zxf lamp.tar.gz cd lamp/ chmod +x *.sh
根据你需要安装的模块执行以下命令
./xcache.sh
./oci8_oracle11g.sh
./pureftpd.sh
./ZendGuardLoader.sh
./ioncube.sh
./ImageMagick.sh
./GraphicsMagick.sh
./opcache.sh
./memcached.sh
./mongodb.sh
./upgrade_php.sh 2>&1 | tee upgrade_php.log
./upgrade_mysql.sh 2>&1 | tee upgrade_mysql.log
./upgrade_mariadb.sh 2>&1 | tee upgrade_mariadb.log
./upgrade_apache.sh 2>&1 | tee upgrade_apache.log
使用提示
lamp add(del,list) 创建(删除,列出)虚拟主机。
lamp ftp(add|del|list) 创建(删除,列出)ftp 用户。
lamp uninstall 一键删除 LAMP(切记,删除之前请注意备份数据!)
程序目录
命令一览
/etc/init.d/mysqld(start|stop|restart|status)
/etc/init.d/httpd(start|stop|restart|status)
/etc/init.d/memcached (start|stop|restart|status)
网站根目录
默认的网站根目录: /data/www/default
默认信息
LAMP 使用方法:
lamp (add, del, list):创建,删除,列出虚拟主机
LAMP 升级方法:
执行脚本:./upgrade.sh
LAMP 卸载方法:
执行脚本:./uninstall.sh
程序默认安装目录:
Apache:/usr/local/apache
PHP:/usr/local/php
MySQL:/usr/local/mysql
MariaDB:/usr/local/mariadb
Percona:/usr/local/percona
可用命令一览:
Apache:/etc/init.d/httpd (start|stop|restart|status)
MySQL:/etc/init.d/mysqld (start|stop|restart|status)
MariaDB:/etc/init.d/mysqld (start|stop|restart|status)
Percona:/etc/init.d/mysqld (start|stop|restart|status)
Memcached:/etc/init.d/memcached (start|stop|restart)
Redis-server:/etc/init.d/redis-server (start|stop|restart)
修改mysql严格模式路径:
/usr/local/mysql/my.cnf
网站默认根目录:
网站默认根目录:/data/www/default
————————-添加同一个ip不同端口站点———————————–
编辑文件:/usr/local/apache/conf/extra/httpd-vhosts.conf,添加以下代码(路径根据情况修改相应路径)
<VirtualHost *:8180> ServerAdmin localhost:8180 DocumentRoot "/data/www/xgllseo" ServerName localhost:8180 #ErrorLog "/data/wwwlog/wwww.avalon123.com/error.log" #CustomLog "/data/wwwlog/wwww.avalon123.com/com-access_log" common <Directory /data/www/xgllseo> Options +Includes -Indexes AllowOverride All Order Deny,Allow Require all granted </Directory> </VirtualHost>
编辑文件:/usr/local/apache/conf/httpd.conf,添加一个8180端口
Listen 45.32.197.199:80 Listen 45.32.197.199:8180
重启apache
/etc/init.d/httpd restart
——————–为网站添加SSL———————-
1,首先要获得ssl证书,到网站https://github.com/letsencrypt/letsencrypt具体教程参考网站内容。
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
//选择 webroot
输入你的域名
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel):www.xgllseo.com
输入网站路径
Input the webroot for test.testnode.com: (Enter 'c' to cancel):/data/www/xgllseo
申请成功就有这样提示:
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0000_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0000_csr-certbot.pem
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/www.xgllseo.com/fullchain.pem. Your cert
will expire on 2017-06-18. To obtain a new or tweaked version of
this certificate in the future, simply run certbot again. To
non-interactively renew *all* of your certificates, run "certbot
renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
查看证书所在目录,执行certbot certificates可以发现证书和私钥都已经在/etc/letsencrypt/live这个目录下了
$ certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Found the following certs:
Certificate Name: www.xgllseo.com
Domains: www.xgllseo.com
Expiry Date: 2017-06-18 04:09:00+00:00 (VALID: 87 days)
Certificate Path: /etc/letsencrypt/live/www.xgllseo.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/www.xgllseo.com/privkey.pem
---------------------------------------------------------------------
2,成功申请到证书后证书基本在/etc/letsencrypt/live/xgllseo.com目录下,分别记录fullchain.pem、privkey.pem的路径。
3,编辑/usr/local/apache/conf/extra/httpd-ssl.conf,添加刚刚那两个证书
<VirtualHost *:443> # General setup for the virtual host DocumentRoot "/data/www/xgllseo" #DirectoryIndex index.php index.html index.htm ServerName www.xgllseo.com:443 #ServerAdmin you@example.com #ErrorLog "/usr/local/apache/logs/error_log" #TransferLog "/usr/local/apache/logs/access_log" SSLEngine on SSLCertificateFile /etc/letsencrypt/live/www.xgllseo.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/www.xgllseo.com/privkey.pem
继续修改,给443端口访问赋值权限
<Directory "/data/www/xgllseo"> #修改相应路径 SSLOptions +StdEnvVars #添加以下3条代码 Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
4,编辑/usr/local/apache/conf/httpd.conf
# Secure (SSL/TLS) connections Include conf/extra/httpd-ssl.conf #把 此代码前面的#删除 #
如果访问https://www.xx.com的时候出现 bad require的字样那么在最底部继续添加
LimitRequestLine 40940 LimitRequestFieldSize 40940
5,做301跳转,即使访问http://www.xx.com也自动跳转为https://www.xx.com页面
编辑:/usr/local/apache/conf/extra/httpd-vhosts.conf
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*) https://sdeno.com$1 [L,R=301] </VirtualHost>
ubuntu 14.04搭建php5.x环境
按照以下步骤进行:
1,
sudo su
2,
apt-get install mysql-server mysql-client
3,
apt-get install apache2
4,
apt-get install php5 libapache2-mod-php5 service apache2 restart
5,
vi /var/www/html/info.php <?php phpinfo(); ?>
6,
apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
service apache2 restart
7,
apt-get install php5-xcache service apache2 restart
8,
apt-get install phpmyadmin sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
https://www.howtoforge.com/ubuntu-lamp-server-with-apache2-php5-mysql-on-14.04-lts
react native 布局 RN css 样式
react_native
在react native中使用的样式布局基本都是flex box的布局方式
作用在父容器:
flexDirection //控制子元素的排列方式
–row:横向布局
–column:纵向布局
alignItems //控制子元素的对齐方式,(竖直方向)
–flex-start:与父组件的顶部对齐
–flex-end:与父组件的底部对齐
–center:处于父容器的中间位置 (设置此值后,如果子元素有设置flex值,那么height:100%就没效果,widht仍然按比例分配)
–stretch:竖直上填充整个容器,子元素不能设置高度
justifyContent //控制子元素的对齐方式,(水平方向)
–flex-start:伸缩项目与父容器左端靠齐。
–flex-end:与父容器右端靠齐。
–center:水平居中。
–space-between:第一个子组件位于父容器左端,最后一个子组件位于父容器最右端。然后平均分配在父容器水平方向上。
–space-around:所有子组件平均分配在父容器的水平方向上,左右都有留空隙
flexWrap
–nowrap:即使空间不够也不换行。
–wrap:空间不够的话自动换行。
——————————————————
作用在子容器:
alignSelf //设置单个元素对齐方式
–auto:按照自身设置的宽高来显示,如果没设置,效果跟streth一样。
–flex-start:与父容器顶部对齐。
–flex-end:与父容器底部对齐。
–center:位于垂直位置。
–streth:垂直拉伸。
flex //效果宽、高均按比例分配
1:宽度陪数 (如果只有一个子元素相当于 宽100% 高100%)
2:宽度陪数
3:宽度陪数
…
https://sanwen8.cn/p/3fdlM7q.html
————————————————-
————————————————-
RN自带的样式本身就有限不跟pc端一样那么丰富,这里列出RN能识别出来的css属性
alignltems
alignSelf
backfaceVisibility
backgroundColor
borderBottomColor
borderBottomLeftRadius
borderBottomRightRadius
borderBottomWidth
borderColor
borderLeftWidth
borderRadius
borderRightColor
borderRightWidth
borderStyle
borderTopLeftRadius
borderTopRightRadius
borderTopWidth
borderWidth
decomposedMatrix
elevation
flex
flexBasis
flexDirection
flexGrow
flexShrink
flexWrap
fontFamily
fontSize
fontStyle
fontVariant
fontWeight
justifyContent
letterSpacing
lineHeight
margin
marginBottom
marginHorizontal
marginVertical
maxHeight
opacity
overflow
overlayColor
paddingHorizontal
paddingVertical
resizeMode
rotation
scaleX
scaleY
shadowColor
shadowOffset
shadowOpacity
shadowRadius
textAlign
textAlignVertical
textDecorationColor
textDecorationLine
textDecorationStyle
textShadowColor
textShadowOffset
textShadowRadius
tintColor
transform
transformMatrix
translateX
translateY
writingDirection
zIndex
本地存储的作用就是能够实现例如:保存用户曾经的搜索记录、视频的播放记录、购物记录等等。不把这些数据存储在数据库是因为没必要浪费资源,这些数据也是可有可无的不重要。
react native也有跟Html5类似的localStorage功能那就是AsyncStorage。
AsyncStorage是全局操作,意思就是AsyncStorage中的this指向的是全局对象。类似于js中的window。官方推荐我们封装后使用不要直接使用。
var React=require('react');
var react_native=require('react-native');
var {
AsyncStorage
} = react_native;
设置:
AsyncStorage.setItem('myname', JSON.stringify({name:'陈陈'}));
获取:
AsyncStorage.getItem('myname').then(function(data){ ... });
删除:
AsyncStorage.removeItem(key);
批量操作:
AsyncStorage.multiSet([['user1','用户1'],['user2','用户2']]).then(function(data){ ... })
AsyncStorage.multiGet(['user1','user2']).then(function(data){ ... })
注意:AsyncStorage是异步操作,在获取值得时候要注意
AsyncStorage.setItem('myname', JSON.stringify(this.state)).then(function () {
AsyncStorage.getItem('myname').then(function (data) {
console.log(this);
console.log(data)
}.bind(this))
})