search
HomeBackend DevelopmentPHP Tutorial不同端口配置多站点错误

php+apache+mysql
不同端口配置多站点错误 配置如下 (仅仅在http.conf中修改)
NameVirtualHost *:80 
NameVirtualHost *:81 
NameVirtualHost *:82 

#第1个站点是用于运行公司网站 

DocumentRoot "D:/myweb/" 
ServerName oa 
php_value include_path ".;D:/myweb" 


#第2个站点是用于运行OA 

DocumentRoot "D:/myoa/webroot/" 
ServerName oa 
php_value include_path ".;D:/myoa/webroot" 


#第3个站点是用于运行独立的论坛 

DocumentRoot "D:/bbs/" 
ServerName oa 


Listen 80 
Listen 81 
Listen 82 

无论如何 80 81 82 都指向D:/bbs/。 没有做到不同端口指向不同的网站,错的 原因,如何修改 ?
(有点文章说要建立一个新的 http2.conf修改,这个方法 跟上面有什么不同)


回复讨论(解决方案)


    ServerAdmin admin@xxxx.com
    DocumentRoot "路径"
    ServerName localadm
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common


照这样类似加几块

都在同一个 httpd.conf   不用新加httpd2.conf??

现在我Listen 200 和Listen 8080多有了,但都是指向8080的位置.设置如下:
01.#Listen 12.34.56.78:80

02.Listen 8080

03.Listen 200

04.

05.#

06.# Dynamic Shared Object (DSO) Support

07.#

08.# To be able to use the functionality of a module which was built as a DSO you

09.# have to place corresponding `LoadModule' lines at this location so the

10.# directives contained in it are actually available _before_ they are used.

11.# Statically compiled modules (those listed by `httpd -l') do not need

12.# to be loaded here.

13.#

14.# Example:

15.# LoadModule foo_module modules/mod_foo.so

16.#

17.LoadModule actions_module modules/mod_actions.so

18.LoadModule alias_module modules/mod_alias.so

19.LoadModule asis_module modules/mod_asis.so

20.LoadModule auth_basic_module modules/mod_auth_basic.so

21.#LoadModule auth_digest_module modules/mod_auth_digest.so

22.#LoadModule authn_anon_module modules/mod_authn_anon.so

23.#LoadModule authn_dbm_module modules/mod_authn_dbm.so

24.LoadModule authn_default_module modules/mod_authn_default.so

25.LoadModule authn_file_module modules/mod_authn_file.so

26.#LoadModule authz_dbm_module modules/mod_authz_dbm.so

27.LoadModule authz_default_module modules/mod_authz_default.so

28.LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

29.LoadModule authz_host_module modules/mod_authz_host.so

30.LoadModule authz_user_module modules/mod_authz_user.so

31.##LoadModule autoindex_module modules/mod_autoindex.so

32.#LoadModule cern_meta_module modules/mod_cern_meta.so

33.LoadModule cgi_module modules/mod_cgi.so

34.#LoadModule dav_module modules/mod_dav.so

35.#LoadModule dav_fs_module modules/mod_dav_fs.so

36.#LoadModule deflate_module modules/mod_deflate.so

37.LoadModule dir_module modules/mod_dir.so

38.LoadModule env_module modules/mod_env.so

39.#LoadModule expires_module modules/mod_expires.so

40.#LoadModule file_cache_module modules/mod_file_cache.so

41.#LoadModule headers_module modules/mod_headers.so

42.LoadModule imagemap_module modules/mod_imagemap.so

43.LoadModule include_module modules/mod_include.so

44.#LoadModule info_module modules/mod_info.so

45.LoadModule isapi_module modules/mod_isapi.so

46.LoadModule log_config_module modules/mod_log_config.so

47.LoadModule mime_module modules/mod_mime.so

48.#LoadModule mime_magic_module modules/mod_mime_magic.so

49.LoadModule proxy_module modules/mod_proxy.so

50.#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

51.#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

52.#LoadModule proxy_connect_module modules/mod_proxy_connect.so

53.LoadModule proxy_http_module modules/mod_proxy_http.so

54.#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

55.LoadModule negotiation_module modules/mod_negotiation.so

56.LoadModule rewrite_module modules/mod_rewrite.so

57.LoadModule setenvif_module modules/mod_setenvif.so

58.#LoadModule speling_module modules/mod_speling.so

59.#LoadModule status_module modules/mod_status.so

60.#LoadModule unique_id_module modules/mod_unique_id.so

61.LoadModule userdir_module modules/mod_userdir.so

62.#LoadModule usertrack_module modules/mod_usertrack.so

63.#LoadModule vhost_alias_module modules/mod_vhost_alias.so

64.#LoadModule ssl_module modules/mod_ssl.so

65.

66.

67.

68.ServerName "web"

69.DocumentRoot "d:/php/wnfenlei"

70.

71.    Options Indexes FollowSymLinks

72.    AllowOverride None

73.    Order allow,deny

74.    Allow from all

75.


76.


77.

78.

79.ServerName "web"

80.DocumentRoot "d:/php/wnarticle"

81.

82.    Options Indexes FollowSymLinks

83.    AllowOverride None

84.    Order allow,deny

85.    Allow from all

86.


87.

Apache 多端口多站点配置方法

我的是 一个oa厂商 的自带的apache (非单独安装的 apache 该厂商禁止安装其他apach)。
没有  上面的 conf/extra/httpd-vhosts.conf
(他类似 wamp方式全部免安装全部二进制的那种)
否则第一个帖子提到(仅仅在http.conf中修改)
前面指出这个  ??    (是否一定需要我另外找个配套的httpd-vhosts.conf
?)

httpd-vhosts.conf 是自写的,不是apache提供的,简单说类似于php的include
没有生效是不是你没有重启apache的原因?

重启了还是不可以的

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Discover File Downloads in Laravel with Storage::downloadDiscover File Downloads in Laravel with Storage::downloadMar 06, 2025 am 02:22 AM

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP.Explain the concept of late static binding in PHP.Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log AnalysisPHP Logging: Best Practices for PHP Log AnalysisMar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

How to Register and Use Laravel Service ProvidersHow to Register and Use Laravel Service ProvidersMar 07, 2025 am 01:18 AM

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),