Ubuntu Server安全Web服務器搭建流程

之前整過CentOS,整了Ubuntu才發現,Ubuntu簡單多了~~不知道性能相比又如何。

以Ubtuntu 14.04爲例,記錄一下搭建流程。


一、SSH服務器

第一件事當然是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
然後會提示你輸入密碼,這是訪問網上鄰居文件夾的密碼。

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章