linux ras目录,Linux下配置站点-FTP-RSA私钥-公钥

1、配置FTP:

1.查看是否已经安装vsftp:

ps -ef |grep vsftpd2.如果没有安装,就安装:

yum install vsftpd -y

3.启动vsftp:

service vsftpd start

查看vsftpd是否启动:

chkconfig --list

4.如果启动不了,就用如下命令:

chkconfig --level 35 vsftpd on

或者:

/etc/rc.d/init.d/vsftpd restart

5.启动之后编辑配置,关闭匿名登录:

vim /etc/vsftpd/vsftpd.conf

下面的:anonymous_enable=NO

编辑完保存::wq

6.重启vsftpd

service vsftpd start

7.停止vsftpd

service vsftpd stop

8.给文件全部权限:

chmod -R 777 wp-content/

9.查看文件信息:

ls -l

10.创建ftp用户:

/usr/sbin/adduser -d /tmp -g ftp -s /sbin/nologin test

PS:创建test用户,但不允许使用远程连接(nologin),只能使用ftp连接

2.RSA

1. 查看目录:# which openssl/usr/local/openssl/bin/openssl

2.输入:openssl  启动OpenSSL

3.生成RSA私钥:

genrsa -out rsa_private_key.pem 1024

转换pck8:

pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM –nocrypt

成功之后会再屏幕上出现“”------- BEGIN PRIVATE KEY---------“”和“”---------END PRIVATE KEY----------“”为标记的几行英文,即为私钥

4.生产公钥:

rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem

此时生成成功后无法看到,可用命名进入文件内部看到:vi rsa_public_key.pem

3.配置站点:

进入nginx配置文件下:

/usr/local/nginx/conf/vhost

添加文件:*****.com.conf   ("****“为域名)

内容如下:server

{

listen       80;

server_name  域名.com;

rewrite ^/(.*)$ http://域名/$1 permanent;

}

server

{

listen 80;

server_name 域名;

index index.html index.htm index.php default.html default.htm default.php;

root  /data1/mob/public;    //备注-文件指向//

include none.conf;

location / {

try_files $uri $uri/ /index.php?$query_string;

}

#error_page   404   /404.html;

location ~ [^/]\.php(/|$)

{

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

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

fastcgi_index index.php;

include fastcgi.conf;

#include pathinfo.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}

location ~ .*\.(js|css)?$

{

expires      12h;

}

access_log off;

}

重启nginx:cd /usr/local/nginx/sbin

重启:./nginx -s reload

4.Nginx下进行重定向:

Nginx下重定向不管用原因可能为:

Nginx下不支持Apache里面的.htaccess里面的重定向(需要在Nginx网站配置文件里面添加代码进行调转)

Nginx下配置(也适用别的网站)网站重定向链接:

目录:/usr/local/nginx/conf/vhost   下面的配置文件:*******.com.conf

加上如下代码:

location /article/ {

rewrite ^/html/y2009/([0-9]+).html$ /community/$1.html permanent;

if ($host !~ "^www\.*****\.com\article\$"){

rewrite ^(.*) http://www.*******.com\community\$1 permanent;

}

if (-f $request_filename/index.html){

rewrite (.*) $1/index.html break;

}

if (-f $request_filename/index.php){

rewrite (.*) $1/article/index.php;

}

if (!-f $request_filename){

rewrite (.*) /article/index.php;

}

}

完!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值