早上好。 试图让这个工作,但我敢肯定,我失去了一些东西。 我的虚拟主机configuration文件: <VirtualHost 127.0.0.11:80> ServerName test.localhost #… </VirtualHost> 我的/ etc / hosts文件: … 127.0.0.11 test.localhost … 当我去http://127.0.0.11它的工作原理,但是当我去http://test.localhost它不会 – 它回落到我在<VirtualHost _default_:*>…</VirtualHost>configuration的默认站点<VirtualHost _default_:*>…</VirtualHost> 。 我已经在这里search了几个小时了,有点不知所措,希望有人能给我一个关于看什么的指针。 谢谢。
我想在mydomain.tld上运行一个正常的网站,但是目录mydomain.tld / ws应该redirect/代理到在127.0.0.1:8989上运行的本地websocket服务器。 这是我到目前为止: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName mydomain.tld DocumentRoot /var/www/mydomain.tld/ ProxyPass /ws ws://127.0.0.1:8989/ ProxyPassReverse /ws ws://127.0.0.1:8989/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/mydomain.tld/> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.mydomain.tld.log CustomLog ${APACHE_LOG_DIR}/access.mydomain.tld.log combined </VirtualHost> 但是,正常的网站工作,但我不能连接到/ ws,因为我得到状态代码403禁止,虽然我收到正确的HTTP响应头X-Powered-By: Ratchet/0.3.4这是WebSocket服务器。 这是从CustomLog结合起来的: someip – – [15/Apr/2016:08:59:31 +0200] "GET /ws HTTP/1.1" […]
我最初以为我有这个问题: https://stackoverflow.com/questions/28572629/a2ensite-site-does-not-exist-error-even-with-conf-file 但是这并没有帮助我。 我在这里cd: /etc/apache2/sites-enabled 我知道a2ensite的path: which a2ensite /usr/sbin/a2ensite 我用这个testing了configuration文件: apachectl configtest 我得到: Syntax OK 我有这个文件: ralph.stagingv2.example.conf 开始于: ServerName ralph.stagingv2.example.com DocumentRoot "/home/ralph/example/current/web" DirectoryIndex index.php 我创build了DocumentRoot: mkdir -p /home/ralph/example/current/web 而且我将权限更改为我们在AWS上使用的用户: chown -R ubuntu /home/ralph/ chgrp -R www-data /home/ralph/ 但是当我这样做: a2ensite ralph.stagingv2.example 我得到: ERROR: Site ralph.stagingv2.example does not exist! 我错过了什么?
我在Centos 7服务器上运行Apache 2.4.17(prefork)。 服务器规格相当不错:2个Xeon E5-2697 v3 @ 2.60GHz,512GB的RAM和8个SSD的RAID 10。 这个Apache服务器用来运行一个PHP软件。 正常的负载在8到15之间,但是由于服务器的规格,它的响应速度非常快。 此外,请求/秒的数量通常低于300。 我注意到有时Apache 甚至会为本地请求而超时。 当请求/秒高于400和/或负载是20+时会发生这种情况。 如果我重试请求,它工作正常。 这里是相关的configuration: Timeout 300 KeepAlive On MaxKeepAliveRequests 500 KeepAliveTimeout 2 <IfModule mpm_prefork_module> ServerLimit 2000 StartServers 30 MinSpareServers 20 MaxSpareServers 80 MaxRequestWorkers 2000 MaxConnectionsPerChild 50000 </IfModule> 一些说明: Apache错误日志根本不显示任何错误。 即使发生这种情况,服务器也会响应。 我可以访问它使用SSH和其他服务工作正常。 我已经安装了munin。 当问题发生至less50%的RAM是免费的,CPU使用率约为70%,I / O使用率非常低。 我怎样才能获得关于这个问题的更多信息? 什么可能导致这种types的超时?
我在我的本地机器上安装了一个通配符子域(在Linux Mint 18.1上运行Apache 2.4.18)上运行我的应用程序(基于laravel 5.4) 所以,我已经为它设置了一个vhost(domain.app)和一个子域(sub.domain.app),我的apache vhost文件如下所示: # This is for the primary domain (domain.app) <VirtualHost *:80> ServerName domain.app ServerAlias www.domain.app ServerAdmin webmaster@localhost DocumentRoot /var/www/html/test/domain.app/public <Directory /var/www/html/test/domain.app/public> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <IfModule mod_dir.c> DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm </IfModule> </VirtualHost> # This is for the subdomain (sub.domain.app) <VirtualHost […]
我可以使用VirtualDocumentRoot生成的文档根作为同一个VirtualHost中其他地方的variables吗? 以下面的VirtualDocumentRoot为例: VirtualDocumentRoot "/var/workspaces/%1" 从主机名test.localhost生成的文档根目录是/var/workspaces/test 。 这也是php中的$_SERVER['DOCUMENT_ROOT']中的文档根目录。 那么我可以在apacheconfiguration中使用PutEnv或Define指令中的实际文档根目录吗? 在实际的文档根目录的Apacheconfiguration中是否有一个variables? 编辑: 我想用这个几个不同的用例。 我想为我的所有应用程序设置一个日志logging目录,所以我想要做这样的事情: SetEnv LOG_DIR ${DOCUMENT_ROOT}/logs/ 或者我想把php-fpm应用程序指向正确的方向: ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9764${DOCUMENT_ROOT}/$1 或者在文档根目录下的子目录中设置一些不同的指令: <Directory "${DOCUMENT_ROOT}/bin">
我已经编译Apache 2.4到Ubuntu的Linux桌面和configurationDocumentRoot指令指向/ usr / local / apache2 / htdocs。 而不是在configuration的DocumentRoot中提供index.html,apache不停地查看/ var / www。 我是否缺less一些configuration? 看来,Apache服务器实际的索引页面从/ var / www当我使用别名localhost作为url,而当使用127.0.0.1它服务于目录索引从documentroot目录 目标是将Apacheconfiguration为从本地主机url下的DocumentRoot提供目录索引 实际configuration: DocumentRoot“/ usr / local / apache2 / htdocs” <目录“/ usr / local / apache2 / htdocs”> 选项+索引 AllowOverride无 要求所有授予 </ Directory>
我想pipe(我的自定义格式)的Apache日志到我的脚本。 我同时希望为每个虚拟主机保持logging标准格式来分隔文件。 当我把CustomLog“/ path / to / my / script”myformat放在httpd.conf中时,它是完美的,但是只适用于没有CustomLog / path / to / logs / vhostXX-logfile其他格式的虚拟主机 对于已经login的虚拟主机,它不logging| / path / to / my / script 我可以把CustomLog“| / path / to / my / script”myformat放在每个虚拟主机中,但是每一个虚拟主机都会产生一个副本,这是不可接受的。 我能做什么?
我有一个Apache服务器,目前,我需要阻止所有访问,但只有一组选定的人。 我认为最简单的方法是拒绝所有stream量的访问,然后只允许selectless量的IP地址。 从我在网上find的,这个configuration应该做的伎俩。 这是/etc/apache2/sites-available/000-default.conf的全部内容: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html> Order allow,deny Deny from all Allow from my.ip.add.res </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 但是,当我testing的时候,我从任何地方都能得到403,包括允许的“my.ip.add.res”IP地址。 我花了相当多的时间Googlesearch,但从我可以告诉,这应该完美的工作。 不知道为什么不是。 我错过了什么明显的?
当服务器重新启动时,有没有办法在access.log中input一些内容? error.log使得它非常清楚(Child:启动工作线程等),但我不希望它在access.log中可见 谢谢!