内容简介:在购买了首先登陆每次都要输密码和记住
在购买了 vps
后,首先应该做一些事情(本文以 mac
的 terminal
作为 SSH
客户端)。
使用 SSH 密匙认证登录 VPS
首先登陆 vps
在 mac
的 terminal
里面可以使用 ssh
命令:
ssh root@your ip # 提示输入密码
每次都要输密码和记住 ip
,好麻烦啊。我们可以直接使用 SSH
密匙认证。
# 1.首先在本机执行 ssh-keygen # 2.复制刚才生成的密钥 cat ~/.ssh/id_rsa.pub # 3.在vps里创建目录 /root/.ssh 并设置权限 mkdir /root/.ssh chmod 700 /root/.ssh # 4.创建authorized_keys vim /root/.ssh/authorized_keys # 把刚才本机创建的密钥粘贴进去
这个时候登陆还是需要记住 ip
,所以我们来设置一个别名, ssh
客户端都有一个配置文件:
vim ~/.ssh/config # 内容格式如下 Host jp HostName your vps ip Port 22 User root PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa # 现在登陆就只要输入: ssh jp
创建普通用户
为了安全,我们应该以普通用户身份操作 vps
。
# 添加用户 useradd -D newuser # 设置密码 passwd newuser # 添加sudo权限 echo -e "\nnewuser ALL=(ALL) ALL\n" >> /etc/sudoers
安装nginx
apt-get install nginx
# 启动
service nginx start
# 配置vhost
cd /etc/nginx/conf.d
touch wulv.site.conf
# 粘贴一下内容
server {
listen 80;
server_name wulv.site www.wulv.site ;
root /usr/share/nginx/html/blog;
index index.php index.html index.htm;
}
# 确保vhost文件加载了
vim /etc/nginx/nginx.conf
# 查看是否有这一行
include /etc/nginx/conf.d/*.conf;
# 重启
service nginx restart
# 静态站点放在
/usr/share/nginx/html/
安装php
apt-get install php7-fpm
vim /etc/php/7.0/fpm/pool.d/www.conf
# 确保有这两行
listen = /run/php/php7.0-fpm.sock
listen = 9000
# 启动php
service php7-fpm start
# nginx支持php
# 在vhost文件里加入
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
# 重启
service nginx restart
安装MySQL
apt-get install mysql-server # 设置远程访问 vim /etc/mysql/my.cnf #找到将bind-address = 127.0.0.1注销 #bind-address = 127.0.0.1 # 登录 mysql -uroot -p grant all privileges on *.* to 'root'@'%' identified by 'xxxxxx'; flush privileges;
常用命令
- ps -aux | grep nginx(查看nginx是否启动)
- netstat -nlt | grep 3306 (检查端口)
- df -h(查看磁盘使用量)
- chmod(改变档案的权限)
- cat filename
- pwd(查看当做操作目录位置)
- ln -s /usr/share/nginx/html ~/html (建立一个软链接)
推荐VPS
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Kubernetes新手指南
- JavaScript Prototype(原型) 新手指南
- alinode 新手村生存指南
- 区块链游戏新手权威指南
- Docker速成 :新手实践指南
- 新手指南 | permeate靶场漏洞挖掘思路分享
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Algorithms for Image Processing and Computer Vision
Parker, J. R. / 2010-12 / 687.00元
A cookbook of algorithms for common image processing applications Thanks to advances in computer hardware and software, algorithms have been developed that support sophisticated image processing with......一起来看看 《Algorithms for Image Processing and Computer Vision》 这本书的介绍吧!