Server Maintain Notes
NFS server
NFS server 是用于局域网环境共享linux硬盘的一种方法。关键的配置文 件有:
/etc/exports
(服务端)
/home $CLIENT_IP1_RANGE(rw,sync,no_root_squash,no_subtree_check)
/home $CLIENT_IP2_RANGE(rw,sync,no_root_squash,no_subtree_check)
...
/etc/fstab
(客户端)
$SERVER_IP:/home /home nfs defaults 0 0
$SERVER_IP:/home/fileserver /homes/fileserver nfs defaults 0 0
...
Nginx
nginx 是轻量级的网站服务,主要的配置文件为:
-
/etc/nginx/nginx.conf
, 该文件一般不用修改; -
/etc/nginx/sites-availble/
或/etc/nginx/conf.d/
,根据需要增加网站配置问题;
server {
listen 80;
listen [::]:80;
server_name domin.com alis www.domin.com;
root /var/www/domin.com;
index index.html;
location / {
try_files $uri $uri/ =404;
}
# 指定文件夹受保护
location "~^/.*/protected/.*" {
try_files $uri $uri/ =404;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
# 指定文件夹中内容按文本文件方式在浏览器中查看
# 让RFun下文件能在浏览器中直接打开,而不是下载。
location ~ .*/RFun/.*\..*$ {
add_header Content-Type text/plain;
}
}
服务重启方式:sudo /etc/init.d/nginx restart
Shiny server
主要配置文件:/etc/shiny-server/shiny-server.conf
demo conf:
# Instruct Shiny Server to run applications as the user "shiny"
# run_as shiny;
run_as cctdb;
# Define a server that listens on port 3838
server {
listen 80;
# Only accept requests for the hostname 'server1.com'
server_name server.domin.com alias IP;
# Define a location at the base URL
location / {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;
# Log all Shiny output to files in this directory
log_dir /home/cctdb/shiny;
# Define the scheduler to use for this location
simple_scheduler 15;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
}
}
server {
listen 80;
# Only accept requests for the hostname 'server1.com'
server_name APP1.domain.com;
# Define a location at the base URL
location / {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server/APP1;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
# Define the scheduler to use for this location
simple_scheduler 15;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
}
}
服务重启方式:
sudo stop|start|restart shiny-server
Rstudio
主要配置文件为端口配置:
/etc/rstudio/rstudio.conf
服务重启方式:
sudo stop|start|restart rstudio-server