您的位置:首页 > 运维架构 > Apache

Apache常用配置

2014-03-07 00:00 211 查看
查看Apache运行用户和组

只需要运行一下命令即可知道

ps -ef |grep httpd

ps -ef |grep apache2

运行之后就显示了httpd进程的运行用户

当然也可以通过查看apache的httpd.conf配置文件来查看apache运行用户和组.

关于虚拟机中的 Web Server

在读取纯静态文件时可能会出现缓存问题。例如 Apache 的 conf 里需要加上这么两行来修正

EnableMMAP Off

EnableSendfile Off

Apache Log

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

LogLevel debug

CustomLog ${APACHE_LOG_DIR}/access.log combined

For debugging mod_rewrite issues, you'll want to use RewriteLogLevel and RewriteLog:

RewriteLogLevel 3
RewriteLog "/usr/local/var/apache/logs/rewrite.log"


How To Set Up Apache Virtual Hosts on Debian 7

sudo mkdir -p /var/www/example.com/public_html

sudo chown -R $USER:$USER /var/www/example.com/public_html

it is important to make sure that everyone will be able to read your new files.

sudo chmod -R 755 /var/www


sudo nano /var/www/example.com/public_html/index.html

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/example.com

sudo nano /etc/apache2/sites-available/example.com

<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
[...]
DocumentRoot /var/www/example.com/public_html

sudo a2ensite example.com

sudo service apache2 restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: