我想在Linux上的apache2.2本地服务器上有多个域。 我编辑了httpd.conf,并在浏览互联网上的各种post后插入了这些代码。 NameVirtualHost *:80 <VirtualHost *:80> ServerName localhost DocumentRoot /home/jharvard/vhosts/localhost </VirtualHost> <VirtualHost *:80> ServerName ratnesh DocumentRoot /home/jharvard/vhosts/ratnesh </VirtualHost> html文件夹位于每个案例的“localhost”和“ratnesh”文件夹中。 然后我编辑/ etc / hosts文件如下: 127.0.0.1 localhost localhost.localdomain 127.0.0.1 ratnesh ratnesh.localdomain 127.0.0.1 appliance appliance.localdomain 然后我重新启动了Apache服务。 但没有帮助。 当我尝试访问本地主机时,我得到了403 FORBIDDEN错误。 而为了访问ratnesh域,它指引我到谷歌search。 此外,当我从“httpd.conf” 删除编辑的代码(上面写的)本地主机工作正常,但ratnesh不。 困住这个问题一个星期,现在真的很沮丧。 希望你会帮助。 谢谢。 问候, Ratnesh
我在本地的纽卡尔有两个Web服务器: 192.168.1.1 – > main apache2 192.168.1.2 – > secondary apache2 所有的http请求都进入端口80到.1我如何创build一个虚拟主机设置来redirect一个子域(比如lights.example.com)到服务器.2? 现在我有这个: <VirtualHost *:80> ServerName lights.example.com RewriteEngine On RewriteRule ^(.*)$ http://192.168.1.2$1 [P] </VirtualHost> 但是当我浏览到lights.example.com我得到一个403: 您无权访问/在此服务器上。 从我的主服务器,但直接浏览我的二手作品罚款。 谢谢! 纳特
我在本地主机的子目录中设置多站点。 问题是,当我试图访问我刚刚创build的网站的仪表板(本地主机/ wptest /网站/ wp-admin),我得到“这个网页有一个redirect循环” ,当我尝试访问实际的网站localhost / wptest / site)页面加载但没有资产,如CSS。 当我访问networking仪表板或localhost / wptest上的主站点仪表板时,一切都很好。 另外当我编辑在networking仪表板的第二个网站的永久链接,就像这样:本地主机/网站它也运行良好。 如何使它与默认的永久链接结构localhost / wptest / site? wordpress文件在 /usr/share/html/wptest wp-config.php如下: define('WP_ALLOW_MULTISITE', true); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'localhost'); define('PATH_CURRENT_SITE', '/wptest/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); 而服务器块/虚拟主机是这样的: server { ##DM – uncomment following line for domain mapping listen 80 default_server; #server_name example.com *.example.com ; ##DM […]
我刚刚创build了虚拟主机: <VirtualHost myvirtualhost:80> ServerAdmin webmaster@myvirtualhost ServerName myvirtualhost DocumentRoot /home/myname/sites/public_html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/myname/sites/public_html/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, […]
我不是新来的阿帕奇,但我拉我的头发在这一个。 我无法在特定的IP上获得第二个VirtualHost。 它似乎只是使用该IP的默认VirtualHost。 我有一个拥有两个IP地址的服务器。 它在两个IP上的端口80和443上运行,这样我有四个NameVirtualHosts,例如 NameVirtualHost 1.1.1.1:80 NameVirtualHost 1.1.1.1:443 NameVirtualHost 2.2.2.2:80 NameVirtualHost 2.2.2.2:443 现在我有一个默认的(即文件被命名,以便它会在下一个之前)VirtualHost for 2.2.2.2:80定义为 <VirtualHost 2.2.2.2:80> ServerAdmin [email protected] CustomLog /var/log/apache2/ip2-80-access.log combined ErrorLog /var/log/apache2/ip2-80-error.log </VirtualHost> 还有第二个 <VirtualHost 2.2.2.2:80> ServerAdmin [email protected] ServerName foo.example.com DocumentRoot /var/www/foo.example.com CustomLog /var/log/apache2/ip2-80-access.log combined ErrorLog /var/log/apache2/ip2-80-error.log </VirtualHost> DNS设置,以便foo.example.com指向2.2.2.2 。 但是,当我尝试访问foo.example.com/anything我得到一个404没有find。 看来apache忽略了我的第二个基于名字和基于ip的虚拟主机。 我在Debian 6(Squeeze)上使用Apache 2.2。 请注意:我不想让Apache在这里selectSSL的虚拟主机(我知道限制/ SNI等),这是标准的端口80。
我已经安装了Nginx,php-fpm,mysql和phpmyadmin .. 当我inputmyserver.com时,我看到“Welcome to nginx!”。 但是当我键入myserver.com/phpmyadmin时,我得到:“没有指定input文件”。 我知道这可能是path上的一个问题,但我找不到在哪里…:S configuration文件: 在/ etc / nginx的/网站可用/默认 server { listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default_server ipv6only=on; ## listen for ipv6 root /usr/share/nginx/www; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name _; location / { try_files $uri $uri/ /index.html; […]
我使用这个脚本https://github.com/gitlabhq/gitlabhq/issues/3626在我的Apache服务器上安装了GitLab,并且我configuration了Apache来将端口8080上的所有内容转发到端口3000,如下所示: <VirtualHost *80> ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/ ProxyPreserveHost On DocumentRoot /var/www <Directory /> Options FollowSymLinks Allow Override </Directory> . . . </VirtualHost> 不过,我想转发一切只为我在这个networking服务器上托pipe的特定网站。 可以这样做吗? 我对这些东西很陌生,如果有什么不清楚的地方,请问。
我在我的本地服务器上有一个奇怪的redirect问题。 我有一个VirtualHost设置: NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/Users/iMac/Sites/index.php" ServerName jordan.local ErrorLog "/private/var/log/apache2/jordan.local-error_log" CustomLog "/private/var/log/apache2/jordan.local-access_log" common <Directory "/Users/iMac/Sites/index.php"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> 访问http://jordan.local工作正常。 但是,当我尝试访问一个子目录jordan.local/somefolder/index.php ,显示的页面是jordan.local/index.php 。 我没有一个.htaccess文件,并重新启动了无数次的Apache。 Apache版本:2.2.22(Unix) Mac OS X 10.7.5 这是我的主机文件,如果有任何帮助: 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost #74.208.10.249 gs.apple.com 127.0.0.1 jordan.local 我访问的所有本地URL(不存在)都显示在我的自定义访问日志中,作为200响应代码。 我的Apache错误日志给出这个警告: Warning: DocumentRoot [/Users/iMac/Sites/index.php] does […]
我看了一下Canonical Topics ServerFault,可悲的是我之前的“Apache vHost”就是没有回答的问题。 我发现这有点令人惊讶,因为有很多人只是问这个问题。 无论如何,我的问题不是关于“如何”,而是关于在虚拟主机configuration文件中使用的“最佳实践”是什么? 我有以下的虚拟主机: <VirtualHost *:80> ServerName example.com DocumentRoot /home/webmaster/examplesite.com/htdocs ErrorLog /home/webmaster/examplesite.com/logfiles/error.log CustomLog /home/webmaster/examplesite.com/logfiles/access.log combined </VirtualHost> 它做的工作,并得到的东西工作,但是我想知道,如果我能改善它。 特别是我想确保以下问题得到解决: 我的网站有多安全? 我想有一个“上传”文件夹,用户可以发布图像。 我需要添加一些东西到vHost文件? 上述设置是否优化了我的网站,还是我可以进一步优化? 还有什么我可能错过了?
我有一个OS X服务器10.8 [与服务器应用程序]。 我已经启用了网站服务,我已经添加了/Volumes/dev1/http的path作为我的服务器网站的根目录。 我在/private/etc/apache2/httpd.conf编辑了文件并添加了以下行: Include /Volumes/dev1/http/.virtual-hosts /Volumes/dev1/http/.virtual-hosts的文件如下所示: listen 80 listen 443 servername "site" serveradmin "[email protected]" namevirtualhost *:80 namevirtualhost *:443 directoryindex .index.php index.html index.php options -indexes -multiviews +followsymlinks <directory /Volumes/dev1/http> allowoverride all </directory> <virtualhost *:80 *:443> servername site.com serveralias www.site.com documentroot "/Volumes/dev1/http/com-site" rewriteengine on </virtualhost> 服务器完全忽略了这个文件,即使我把一些随机的字符放到apachectl -t里面 – 它说那个语法不行。 我甚至尝试过在这个文件中只有directoryindex .index.php ,它仍然没有效果 – 它返回403禁止,甚至认为.index.php存在。 这个确切的configuration就像一个老式的10.6服务器的魅力。 […]