我在使用 mod_php 设置 Apache 服务器时遇到问题。我有一个网站,其 index.php 页面在 ~200 毫秒内生成。但是 Apache 在大约 1.5 秒内提供它。为什么会出现这种放缓?
如果需要,我的/etc/apache2/ports.conf
文件是:
Listen 80
<VirtualHost *:80>
ServerName mysite.local
ServerAlias www.mysite.local
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:9999/
ProxyPassReverse / http://localhost:9999/
</VirtualHost>
我的文件/etc/apache2/sites-available/mysite.local.conf
是:
Listen 9999
User max
Group max
<VirtualHost *:9999>
ServerName 127.0.0.1:9999
DocumentRoot /home/max/www/mysite.local/www/html/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/max/www/mysite.local/www>
Options FollowSymLinks
AllowOverride All
#Order allow,deny
#Allow from all
Require all granted
</Directory>
ErrorLog /home/max/www/mysite.local/logs/error.log
LogLevel warn
CustomLog /home/max/www/mysite.local/logs/access.log combined
</VirtualHost>
我的主要问题是为什么这么慢,如何让它更快?我已经测试过将 index.php 内容放入一个普通的 html 文件中,并且在大约 10 毫秒内提供服务。所以问题可能出在 mod_php 上?提前致谢。