Articles of 虚拟主机

在Vagrant框中,Apache虚拟主机被忽略

我遇到的问题是,当我从主机访问http://d7.subdomain.example.org时,它会将我带到默认的apache It Works页面。 我在带有带有virtualbox提供程序的Ubuntu 12.04 Vagrant框的Mac主机上。 我已经检查了sites-enabled /,并且在运行sudo a2ensite d7.subdomain.example.org命令之后,站点确实出现在那里。 如果我去http://d7.subdomain.example.org/drupal/site-docroot它把我带到正确的地方。 这似乎是无视我的虚拟主机一起。 我的stream浪文件: # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "precise32" config.vm.box_url = "http://files.vagrantup.com/precise32.box" config.hostmanager.enabled = true config.hostmanager.manage_host = true config.vm.define "drupal" do |node| node.vm.hostname = "d7.subdomain.example.org" node.vm.network :private_network, ip: "172.22.22.26" node.hostmanager.aliases = [ "www.d7.subdomain.example.org" ] end […]

虚拟主机在Nginx中无法正常工作

我正在用以下configuration使用nginx创build虚拟主机: server { listen 7001; server_name example.com; location / { root html; index index.html index.htm; } } 当我尝试访问example.com或exemple.com:7001 ,它不工作,但它正在工作,当我通过localhost:7001访问localhost:7001 ,在我的configuration错误? 编辑1 我在Windows平台上 编辑2 当我尝试通过example.com或example.com:7001访问时,它将访问在线example.com网站,或者在访问example.com:7001时发现网站未find通知:

虚拟主机不在Fedora 22中工作

最近我已经从Ubuntu转到Fedora Workstation作为我的开发环境,以便更好地理解centOS服务器(以及其他原因)。 我一直在试图build立一个本地LAMP堆栈进行开发。 这是我的atm : httpd Apache/2.4.16 (Fedora), runs as apache/apache, mod_php is disabled, handler is "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost" php 5.6.14 php-fpm runs as apache/apache, path is /run/php-fpm/www.sock, process type is mpm_event /etc/httpd/conf.d/php.conf <IfModule !mod_php5.c> <FilesMatch \.php$> SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch> </IfModule> 我还没有真正引起/etc/httpd/conf/httpd.conf任何设置。 服务器和PHP似乎为/var/www/html正常工作,但是当我尝试创build一个新的VirtualHost ,我得到了所有目录403 。 我正在尝试通过添加一个configuration文件到一个新的虚拟主机: /etc/httpd/conf.d/sites.conf <VirtualHost *:80> ServerName site1.local ServerAlias site1alias.local DocumentRoot /home/myuser/Projects/site1/www <Directory /home/myuser/Projects/site1/www> […]

显示我的域名,而不是我的IP与Apache

我拥有的 我有一个域configuration为指向我的服务器。 当我去我的领域,让我们说: example.com 它将我redirect到: http://104.286.131.72/mysitefolder/index.php? 当然,它显示我正确的网站。 我有这个Apache和一个名为/etc/apache2/sites-enabled/000-default.conf与这个内容的文件: <VirtualHost *:80> DocumentRoot /var/www/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/mysitefolder/ ServerName example.com ServerAlias www.example.com </VirtualHost> 我想要的是 当我去我的领域: example.com 它将我redirect到: http://example.com/index.php? 并向我展示相同的网站。 我怎样才能做到这一点? UPDATE1 试图将第二个块更改为@imvikasmunjal答案,我敢这样做: The requested URL /mysitefolder/index.php was not found on this server. /var/log/apache2/access.log文件说: 190.126.199.244 – – [25/Apr/2016:01:43:43 -0400] "GET /mysitefolder/index.php? HTTP/1.1" […]

在Linux服务器上隔离虚拟主机的最佳方法是什么?

首先,我想知道什么是隔离Apache的虚拟主机的最好方法。 我想这也是Linux文件系统的一些问题,因为在/var/www/site1.com/public_html和/var/www/site2.com/public_html类的文件夹(和文件)不是一个好习惯。相同的Linux用户/组。 我发现这个类似的post: 从系统的其余部分分离Apache虚拟主机,但注意到这是关于从系统隔离虚拟主机。 一个很好的做法,但不是我所做的。 我不希望任何可能的方式, site1.com可以访问site1.com文件,如果可能的site2.com ,除了它自己的目录和子目录,文件系统也不需要任何东西。 其次,chmod对用户权限的影响是什么。 假设两个网站都在自己的用户和用户组中运行。 但site1.com有一个文件或目录与chmod权利777. site2.com将能够使用该文件/目录?

apache2重写configuration不工作

我有一个文件www.example.org.conf ,我想将httpredirect到https 。 问题是该文件不完全正确的工作。 <VirtualHost *:80> ServerName example.org ServerAlias www.example.org DocumentRoot "/var/www/example.org/www" CustomLog /var/www/example.org/www.access.log common ErrorLog /var/www/example.org/www.error.log RewriteEngine on RewriteCond %{SERVER_NAME} =example.org [OR] RewriteCond %{SERVER_NAME} =www.example.org RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] </VirtualHost> redirect实际上是从letsencrypt自动生成的,但是这是问题所在。 在http://www.example.org中键入将按照预期redirect到https://www.example.org 。 问题是当你inputhttp://example.org时 ,它将显示apache的默认页面,而不是redirect到https。 当我inputhttps://example.org或https://www.example.org (显示我想要的页面)时,我可以validationSSL conf是否正常工作。 所以我得出结论,问题在于mod_rewrite 。 但是,我不知道什么是错的。 事实上,我遵循相同结构的其他虚拟主机按预期工作。 请帮我弄清楚我的网站configuration有什么问题。 顺便说一句,我使用Debian的Apache2。

在Apache conf指令中包含文本文件

我需要将Alias添加到服务器的主Web指令中,我不想通过主configuration文件来完成。 例如,我想知道是否有办法将另一个文件中的文本包含到指令中 <VirtualHost *:80> DocumentRoot /var/www ServerName *.website.co Alias "/old_directory" "/var/www/old_content/old_directory/" </VirtualHost> 因此,如果URL与old_directory匹配,那么用户将被提供别名。 上面的工作正常,但是我想使这个dynamic和不移动主规则到一个单独的conf文件。 所以像这样的东西: <VirtualHost *:80> DocumentRoot /var/www ServerName *.website.co * include a file /var/www/alias/alias.txt </VirtualHost> 在alias.txt文件中,我将有一个别名列表 Alias "/old_directory" "/var/www/old_content/old_directory/" Alias "/old_directory1" "/var/www/old_content/old_directory/1" Alias "/old_directory2" "/var/www/old_content/old_directory/2" Alias "/old_directory3" "/var/www/old_content/old_directory/3" etc. 在这种情况下,我不想将主要的虚拟主机指令移出主要的configuration文件,当试图使用“包含”选项复制另一个文件中的规则时,它忽略了那个,因为它已经被声明了。 有没有包括这样的,还是有更好的方法来处理这个?

用于在Ubuntu 16.04上托pipe多个网站的NGINX服务器块configuration

我想在Ubuntu 16.04(Ubuntu-NGINX-MariaDB-PHP)上托pipe多个WordPress网站。 我不想使用WordPress的多站点。 我遵循这个指南 。 一切都很好,但我只能托pipe一个网站。 每当我创build多个服务器块configuration,它开始显示错误,NGINX无法启动。 我没有得到我的configuration文件正确。 这里是configuration文件: server { listen [::]:80 ipv6only=off; server_name abcde.org www.abcde.org; root /var/www/abcde; # Add index.php to the list if you are using PHP index index.php index.html index.htm index.nginx-debian.html; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying […]

如何使example.com/advice成为虚拟主机

所以我不确定这种设置是怎么调用的,所以我很难对它进行谷歌search,看看我是否在正确的方向前进。 我目前有什么 我有一个CMS,有一个虚拟主机www.example.com ,pipe理界面这是在一个子域admin.www.example.com 。 我需要的 现在除了CMS,我需要有一个论坛平台,并运行。 这是如何设立的 www.example.com – > CMS www.example.com/advice – >论坛 这是一个像这样可能与Apache? 细节 我在apache 2.4.6上运行centos7。 我现在的虚拟主机就像下面这样 <VirtualHost *:80> ServerName example.com DocumentRoot /www/example.com SetEnv ADMIN_DOMAIM 0 <Directory "/www/example.com> AllowOverride All Options FollowSymLinks </Directory> php_value mbstring.func_overload 0 DirectoryIndex index.php </VirtualHost> <VirtualHost *:80> ServerName admin.example.com DocumentRoot /www/example.com SetEnv ADMIN_DOMAIN 1 <Directory /www/example.com> AllowOverride All […]

Nginx如何select一个网站服务于2个网站的实例?

我在AWS上复制了一个EC2实例,因为所有者丢失了pem文件,无法进入SSH。它configuration了两个站点,但是当我通过其公共DNS访问此服务器时,它为我提供了其中一个站点。 它如何知道select它为我服务的网站? 我没有看到任何configuration,表明其中一个网站是默认的(像listen 80 default )。 在/etc/nginx/sites-available (按顺序): default new-site site 在/etc/nginx/sites-enabled (按顺序): new-site site