Ubuntu Server安全Webserver搭建流程

之前整过CentOS。整了Ubuntu才发现,Ubuntu简单多了~~不知道性能相比又怎样。

以Ubtuntu 14.04为例。记录一下搭建流程。


一、SSHserver

第一件事当然是ssh,默认安装后vi /etc/ssh/sshd_config。改动配置文件。

改动/etc/hosts.allow

sshd: 192.168.1. , 192.168.0. : allow

改动/etc/hosts.deny

sshd : ALL

二、系统更新

先更新源,用以Trusty Tahr (14.04)为例,其它版本号看配置生成器

deb http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

再更新apt-get

sudo apt-get update
sudo apt-get upgrade
然后更新系统

sudo apt-get install update

三、Samba网上邻居安装

1. 安装 apt-get install samba

2.为samba创建ubuntu系统已经存在的用户somebody:

smbpasswd -a somebody
然后会提示你输入password,这是訪问网上邻居目录的password。

3.改动配置文件:

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
vi /etc/samba/smb.conf
在其后添加共享文件夹:

[share]
    path = /home/somebody/samba_share
      available = yes 
      browseable = yes 
      public = no 
      writable = yes
4. 重新启动samba就能够像windows一样訪问

/etc/init.d/samba restart


四、安装apache2

sudo apt-get install apache2

装好后訪问http://localhost就能够看到“It Works!”

apache2配置文件在/etc/apache2/apache2.conf,web文件夹在/var/www/html

默认用户是www-data。定义在./envvars文件里

其它配置文件在:./sites-enabled/*.conf

原文地址:https://www.cnblogs.com/zfyouxi/p/5262829.html