javascript - 配置Apache针对不同的根域名指向不同目录,求助!!!!
首先我模拟了2个域名,如图
然后我针对两个根域名,分别指向了不同的目录,如图
然后sudo apachectl restart,最后,尝试访问,结果却不行,请我我哪里错了?
权限也给了啊
回复内容:
首先我模拟了2个域名,如图
然后我针对两个根域名,分别指向了不同的目录,如图
然后sudo apachectl restart,最后,尝试访问,结果却不行,请我我哪里错了?
权限也给了啊
403 Forbidden? Apache 我没有用过,但是我在Mac上使用Nginx反向代理时遇到了一个403的错误,原因是: 当用户需要获取一个文件时,需要他的每一个父文件夹都有可执行权限(x)才行,因此解决办法: chmod -R o+x <path> </path>
你可以试试能解决不,希望会有帮助~
更新一下: 看你补充了问题说权限也给了(读和写),不过我说的可执行权限(x),而且不单是项目文件夹,到项目的整个路径文件夹都需要,不知道你有没有弄懂……
你确认下httpd.conf下的Directory配置,或者你可以选择在vhost内部增加一个Directory配置,我的配置如下供参考:
<code><directory></directory> Options ExecCGI FollowSymLinks Includes IncludesNOEXEC -Indexes -MultiViews SymLinksIfOwnerMatch AllowOverride All Order allow,deny Allow from all </code>
楼上 查尔斯 的回答基本正确,但是直接对根目录 / 开启权限在某些情况下会有安全问题所以直接对/Users/gao/project设置就足够了。
另外 如果你用Apache 2.2 用
<code><directory> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all </directory> </code>
如果用Apache 2.4, 用:
<code><directory> Options Indexes FollowSymLinks AllowOverride all Require all granted </directory></code>
至于这个配置信息存到哪,其实大部分地方都可以,直接放在vHost的配置文件可以,apache2.conf也可以。
conf/http-vhost.conf
我再说最后一次:
计算机永远是对的.(绝~~~大多数情况下).
你的计算机告诉你403, 那就是事实. 虽然你说你给了权限, 但是很显然你给权限的"姿势"有问题.
确认apache启动的用户, nobody? www?
确认document root 所属用户.
群人document root 权限(可读?可写?)
BTW: 既然用了MAC, 而且还是搞服务器软件, 建议你多用命令行. 不是说图形界面不好, 只是搞服务器的人基本都用命令行, 你很难用图形界面跟这帮人把问题描述清楚.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Java is a popular programming language that can be learned by both beginners and experienced developers. This tutorial starts with basic concepts and progresses through advanced topics. After installing the Java Development Kit, you can practice programming by creating a simple "Hello, World!" program. After you understand the code, use the command prompt to compile and run the program, and "Hello, World!" will be output on the console. Learning Java starts your programming journey, and as your mastery deepens, you can create more complex applications.

Capsules are three-dimensional geometric figures, composed of a cylinder and a hemisphere at both ends. The volume of the capsule can be calculated by adding the volume of the cylinder and the volume of the hemisphere at both ends. This tutorial will discuss how to calculate the volume of a given capsule in Java using different methods. Capsule volume formula The formula for capsule volume is as follows: Capsule volume = Cylindrical volume Volume Two hemisphere volume in, r: The radius of the hemisphere. h: The height of the cylinder (excluding the hemisphere). Example 1 enter Radius = 5 units Height = 10 units Output Volume = 1570.8 cubic units explain Calculate volume using formula: Volume = π × r2 × h (4
