ubuntu apache2 mysql_Ubuntu Apache2 PHP Mysql配置

<1>Apache2文件目录说明

默认站点在 /var/www/

配置文件在 /etc/apache2/

日志在 /var/log/apache/

启动脚本是 /usr/sin/apache2ctl 或者 /etc/init.d/apache2

普通的apache发行版本配置文件是:httpd.conf

Ubuntu发行版本的主配置文件是:apache2.conf

在apache2.conf引用到了以下文件:

# 包含动态模块的配置:

Include /etc/apache2/mods-enabled/*.loadInclude

/etc/apache2/mods-enabled/*.conf

# 包含用户自己的配置:

Include /etc/apache2/httpd.conf

# 包含端口监听的配置:

Include /etc/apache2/ports.conf

# 包含一般性的配置语句片断:

Include /etc/apache2/conf.d/

# 包含虚拟主机的配置指令:

Include /etc/apache2/sites-enabled/

<2>支持ssl

#开启SSL模块

过去的版本

/opt/apache2/bin/apachectl startssl

在Ubuntu下出错,换用

a2enmod ssl

相当于

sudo ln -s /etc/apache2/mods-available/ssl.load

/etc/apache2/mods-enabled

sudo ln -s /etc/apache2/mods-available/ssl.conf

/etc/apache2/mods-enabled

然后Include /etc/apache2/mods-enabled/*.load

或直接在apache2.conf中加入模块引导

LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so

#创建证书

可以使用apache内置的工具创建默认的证书,通过-days指定有效期。

apache2-ssl-certificate

另外我们可以使用openssl来创建

openssl req -x509 -newkey rsa:1024 -keyout apache.pem -out

apache.pem -nodes -days 999

#编辑SSL的配置

#nano /etc/apache2/sites-enabled/001-ssl

端口改为443,加入SSL认证配置

NameVirtualHost *:443

ServerSignature On

SSLEngine On

SSLCertificateFile /etc/apache2/ssl/apache.pem

ServerAdmin webmaster@localhost

#[......]

修改普通http方式的配置

#vi /etc/apache2/sites-enabled/000-default

把端口改为80

NameVirtualHost *:80

ServerAdmin webmaster@localhost

#[......]

编辑Apache端口配置,加入443端口(SSL)

#vi /etc/apache2/ports.conf:

Listen 80

Listen 443

重新启动Apache2

#/etc/init.d/apache2 restart

eg:

DocumentRoot "/var/www" ServerName $name$ SSLEngine on

SSLCertificateFile "/var/www/serve.cer" SSLCertificateKeyFile

"/var/www/serve.key"

<3>404页面

nano /etc/httpd/conf/httpd.conf

修改添加

ErrorDocument 404 /404.html

放置404错误页面的路径为apache根目录中,如/var/www

重启apache2

<4>隐藏版本信息

其他版本可修改httpd.conf

ServerTokens ProductOnly

ServerSignature Off

TraceEnable off

关闭trace-method

TraceEnable off

Ubuntu发行版下

修改配置文件

/etc/apache2/apache2.conf

修改ServerTokens

找到ServerTokens Full所在行,改为:

ServerTokens Prod

没有就添加上面这一行即可.

重新加载Apache的配置:

/etc/init.d/apache2 reload

<5>etc.

php sec config

sys user sec setting

-=-=

1.change hostname

2.change dns through /etc/resolv.conf

3.change ssh 22port

4.lamp install

apt-get install apache2 mysql-server mysql-client php5 php5-gd

php5-mysql

chmod 7xx /var/www/

apt-get install phpmyadmin

ln -s /usr/share/phpmyadmin /var/www

a2enmod rewrite

a2enmod ssl

/etc/init.d/apache2 restart

5.ssh-proxy user add

groupadd proxy

useradd -m -g proxy -s /bin/false proxyname

passwd proxyname

6.install etc

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值