本文将带您了解关于配置Apache反向代理以在生产中托管LaravelEchoServer的新内容,同时我们还将为您解释apache反向代理配置原理的相关知识,另外,我们还将为您提供关于apache-
本文将带您了解关于配置Apache反向代理以在生产中托管Laravel Echo Server的新内容,同时我们还将为您解释apache反向代理配置原理的相关知识,另外,我们还将为您提供关于apache - laravel中如何去掉URL中烦人的server.SegmentFault、Apache HTTP Server、IIS反向代理设置、Apache http server配置正向代理、Apache Traffic Server 5.2.0 发布,反向代理服务的实用信息。
本文目录一览:- 配置Apache反向代理以在生产中托管Laravel Echo Server(apache反向代理配置原理)
- apache - laravel中如何去掉URL中烦人的server.SegmentFault
- Apache HTTP Server、IIS反向代理设置
- Apache http server配置正向代理
- Apache Traffic Server 5.2.0 发布,反向代理服务
配置Apache反向代理以在生产中托管Laravel Echo Server(apache反向代理配置原理)
我需要托管一个通过HTTPS服务器使用laravel-echo-server的laravel应用程序。
我想使用Apache的反向代理将我的/socket.io
URL轮询重定向到同一域URL
中正在运行的127.0.0.1
端口上。6001``laravel-echo-server
例如,https://example.com
当我laravel-echo-server
向https://example.com/socket.io
apache
发送url民意调查时,应将其重定向到http://127.0.0.1:6001
同一域内。
注意
我不是将laravel应用托管在cpanel的子目录中,而是托管在根目录中。
我的服务器是a VPS
,我从一个子域主机托管,该子域主机运行在与主服务器主机不同的IP地址上。
假设我的主要主机host.mydomain.com
具有指向/home/...
目录的唯一IP地址。这在http
现在,我有一个domestic.mydomain.com
指向/home/domestic/...
目录的唯一IP地址,这是我托管laravel应用程序的位置。这在上运行https
。
但是我的cpanel登录来自host.mydomain.com
我访问domestic.mydomain.com
文件管理器的IP地址
我的laravel-echo-server.json
模样:
{ "authHost": "https://example.com", "authEndpoint": "/broadcasting/auth", "clients": [ { "appId": "xxxx", "key": "xxxxxxxx" } ], "database": "redis", "databaseConfig": { "redis": {}, "sqlite": { "databasePath": "/database/laravel-echo-server.sqlite" } }, "devMode": false, "host": "127.0.0.1", "port": "6001", "protocol": "http", "socketio": {}, "sslCertPath": "", "sslKeyPath": "", "sslCertChainPath": "", "sslPassphrase": "", "subscribers": { "http": true, "redis": true }, "apiOriginAllow": { "allowCors": false, "allowOrigin": "", "allowMethods": "", "allowHeaders": "" }}
我如何部署我的laravel-echo
:
import Echo from "laravel-echo";window.io = require(''socket.io-client'');// Have this in case you stop running your laravel echo serverif (typeof io !== ''undefined'') { window.Echo = new Echo({ broadcaster: ''socket.io'', host: window.location.hostname, }); window.Echo.channel(''session-expired'') .listen(''sessionExpired'', (e) => { setTimeout(location.reload(), 3000); });}
当我运行时,laravel-echo-server start
它会成功初始化并显示running on 127.0.0.1 on port 6001
然后这是我的Apache反向代理配置/etc/httpd/conf/httpd.conf
:
LoadModule proxy_module modules/mod_proxy.soLoadModule proxy_http_module modules/mod_proxy_http.so# mod_proxy setup.ProxyRequests OffProxyPass /socket.io http://127.0.0.1:6001ProxyPassReverse /socket.io http://127.0.0.1:6001<Location "/socket.io"> Order allow,deny Allow from all</Location>
我的问题是,当我打开网站时,民意测验会同时返回一组OK
和404
响应,但它没有加入socket.io中的任何通道。经过大量测试,我发现代理确实可以重定向,但是我怀疑它是否达到了我想要的特定代理。
这是我的404的HTML响应,这不是服务器配置的404响应:
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Error</title></head><body><pre>Cannot POST /</pre></body></html>
它可以在我的本地服务器上完美运行,但是我需要使其在我的生产服务器上运行。
答案1
小编典典终于明白了,这是我的laravel-echo-server.json
:
{ "authHost": "https://example-domain.com", "authEndpoint": "/broadcasting/auth", "clients": [ { "appId": "xxxxxxx", "key": "xxxxxxxxxxxxxx" } ], "database": "redis", "databaseConfig": { "redis": { "port": "6379", "host": "localhost" }, "sqlite": {} }, "devMode": true, "host": "localhost", "port": "6001", "protocol": "http", "socketio": {}, "sslCertPath": "/path/to/ssl/crt/crt.pem", // or .crt "sslKeyPath": "/path/to/ssl/key/crt.pem", // or .key "sslCertChainPath": "", "sslPassphrase": "", "subscribers": { "http": true, "redis": true }, "apiOriginAllow": { "allowCors": true, "allowOrigin": "*", "allowMethods": "GET, POST", "allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id" }}
我如何使用laravel-echo-server.json:
import Echo from "laravel-echo";window.io = require(''socket.io-client'');// Have this in case you stop running your laravel echo serverif (typeof io !== ''undefined'') { window.Echo = new Echo({ broadcaster: ''socket.io'', host: window.location.hostname, });}
在virtualhost
我的域的SSL中的我的apaxhe配置:
RewriteEngine OnRewriteCond %{REQUEST_URI} ^/socket.io [NC]RewriteCond %{QUERY_STRING} transport=websocket [NC]RewriteRule /(.*) ws://localhost:6001/$1 [P,L]ProxyPass /socket.io http://localhost:6001/socket.ioProxyPassReverse /socket.io http://localhost:6001/socket.io
apache - laravel中如何去掉URL中烦人的server.SegmentFault
许多web框架中都存在类似index.* 的入口文件,而在
于是便想问有没有办法去掉烦人的‘server.php’。下面说说我尝试过的办法:
我是按照网上教程来的,首先我修改了Apache的httpd.conf(我使用的是Wamp)
1,在“Listen 80”的下一行增加了“RewriteEngine on”
2,去掉了LoadModule rewrite_module modules/mod_rewrite.so 前面的注释
3,新增一项Directory(httpd.conf文件中已经存在Directory,我不确定再添加会不会有事
Directory内容:
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
4,配置laravel项目文件中的.htaccess(省略了方括号,因为无法显示)
IfModule mod_rewrite.c
Options +FollowSymLinks
RewriteEngine On
IfModule
IfModule mod_rewrite.c
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ server.php/$1 [L]
IfModule
5,在app/config/local/app.php中添加''server'' => '''',
到此,配置完成,但问题依旧,''server.php''并没有消失,该出现它的地方还是出现了,该加它的地方还是要加。就好像以上配置全部无效一样。
有人试过去掉''server.php''吗?求解惑
回复内容:
许多web框架中都存在类似index.* 的入口文件,而在laravel中则是server.php。比起其他框架,laravel中的server.php经常在url中出现,比如:主页是http://localhost/,但当请求其他页面时,url就变成了http://localhost/server.php/some。个人觉得这样很不美观,开发时也会遇到一些路径问题。
于是便想问有没有办法去掉烦人的‘server.php’。下面说说我尝试过的办法:
我是按照网上教程来的,首先我修改了Apache的httpd.conf(我使用的是Wamp)
1,在“Listen 80”的下一行增加了“RewriteEngine on”
2,去掉了LoadModule rewrite_module modules/mod_rewrite.so 前面的注释
3,新增一项Directory(httpd.conf文件中已经存在Directory,我不确定再添加会不会有事
Directory内容:
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
4,配置laravel项目文件中的.htaccess(省略了方括号,因为无法显示)
IfModule mod_rewrite.c
Options +FollowSymLinks
RewriteEngine On
IfModule
IfModule mod_rewrite.c
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ server.php/$1 [L]
IfModule
5,在app/config/local/app.php中添加''server'' => '''',
到此,配置完成,但问题依旧,''server.php''并没有消失,该出现它的地方还是出现了,该加它的地方还是要加。就好像以上配置全部无效一样。
有人试过去掉''server.php''吗?求解惑
laravel最好是自己配置虚拟主机的,直接指向 public里的index.php
如果非要不指定,可以看看这个 http://blog.segmentfault.com/xiaobeicn/1190000000460901。
server.php 其实是给php内置的服务器用的 当使用 php -S localhost:9999 开启内置服务器的时候就会使用server.php 做了部分url兼容的工作
最佳的部署 同时也是官方推荐的 都是把根路径指向 public , 入口文件就是 index.php
这样也可以避免一些安全问题
http://blog.csdn.net/yingdynasty/article/details/49995371
不谢 哈哈哈
Apache HTTP Server、IIS反向代理设置
Apache HTTP Server
在 Apache 中设置反向代理,需要使用 mod_proxy 和相关的模块,如 mod_proxy_http。以下是一个基本的配置示例:
确保已经安装并启用了 mod_proxy 和 mod_proxy_http 模块。
编辑 Apache 配置文件(通常是 httpd.conf 或者 apache2.conf,取决于操作系统和Apache版本)或者在一个虚拟主机配置文件中添加以下内容:
<VirtualHost *:80>
ServerName www.example.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://backendserver.example.com/
ProxyPassReverse / http://backendserver.example.com/
</VirtualHost>
在上面的配置中,所有到达 www.example.com 的请求都会被转发到 http://backendserver.example.com/。
重启 Apache 以应用更改。
Internet Information Services (IIS)
在 IIS 中设置反向代理,需要使用 Application Request Routing (ARR) 和 URL Rewrite 模块。
首先,下载并安装 ARR 和 URL Rewrite 模块。
打开 IIS Manager。
选择服务器名称,在服务器级别打开 "URL Rewrite"。
点击 "添加规则(s)",选择 "反向代理"。
在 "反向代理" 设置中,输入后端服务器的地址,并根据需要配置其他设置。
点击 "确定" 保存规则。
Apache Tomcat
Apache Tomcat 通常不作为反向代理使用,因为它主要是一个应用服务器,专门用于运行 Java 应用程序。当需要为 Tomcat 提供的应用程序设置反向代理时,通常会在 Tomcat 前面放一个专门的反向代理服务器,如 Apache HTTP Server 或 Nginx。
如果你想要使用 Apache HTTP Server 作为反向代理来代理 Tomcat,你可以按照以下步骤操作:
确保 Apache HTTP Server 已经安装了 mod_proxy 和 mod_proxy_ajp 模块。
在 Apache 的配置文件中(通常是 httpd.conf 或者在 sites-available 目录下的虚拟主机配置文件),添加以下配置:
<VirtualHost *:80>
ServerName www.example.com
开启代理功能
ProxyRequests Off
ProxyPreserveHost On
代理传递设置
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>
在这个例子中,所有到达 www.example.com 的 HTTP 请求都会通过 AJP 协议转发到运行在本地的 Tomcat 服务器的 8009 端口。
确保 Tomcat 的 server.xml 配置文件中 AJP Connector 是开启的:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
重启 Apache HTTP Server 和 Tomcat 以应用这些更改。
如果想要使用其他的反向代理服务器如 Nginx,配置方法会有所不同,但基本原理相同:你将设置 Nginx 或其他代理服务器来接收客户端请求,并将这些请求转发到 Tomcat 服务器。
Tomcat 本身不提供反向代理的功能,需要一个额外的组件(如 Apache HTTP Server 或 Nginx)来实现这一功能。
Apache http server配置正向代理
1. 我们将网上下载的Windows版本压缩包解压到我们想存放的位置:
2. 以管理员身份运行CMD:
3. 进入到文件的bin目录下,执行 httpd -k install命令:
上述问题是因为程序默认安装目录和实际安装目录不一样导致的,我们来修改程序默认安装目录:
在conf目录下找到httpd.conf文件打开并找到 Define SRVROOT ,将后面的路径改为自己的安装路径(注意引号!)。
4. 再启动http server服务,成功:
下面进行正向代理配置:
1.打开刚才设置默认路径的httpd.conf文件,将LoadModule proxy_module modules/mod_proxy.so,LoadModule proxy_connect_module modules/mod_proxy_connect.so,LoadModule proxy_ftp_module modules/mod_proxy_ftp.so,LoadModule proxy_http_module modules/mod_proxy_http.so 这四行的注释符号#去掉:
2. 将引进vhosts文件前面的注释#号去掉 : Include conf/extra/httpd-vhosts.conf :
3. 设置监听的端口号:
(1) 配置httpd.conf
(2)配置httpd-vhosts.conf : NameVirtualHost *:端口号
4. 去掉注释并修改:
VirtualHost 后面的参数可以设置为IP/域名/端口
ProxyRequests On:开启Apache正向代理
ProxyVia On:控制位于代理服务器链中的代理请求的流向
Apache Traffic Server 5.2.0 发布,反向代理服务
Apache Traffic Server 5.2.0 发布,Traffic Server 是一套快速、模块化的兼容 HTTP/1.1 的反向代理服务器,与 Nginx 和 Squid 类似,目前该项目已经转到 Apache 基金会。
该版本包含 bug 修复,新特性和改进,详细介绍请看这里。
完整的记录包括:
Sub-task
[TS-1476] - static analysis: argument with ''nonnull'' attribute passed null
[TS-1477] - static analysis: dead store, dead assignment
[TS-1478] - static analysis: dead store, dead increment
[TS-1479] - static analysis: dead store, dead initialization
[TS-1480] - static analysis: logic error, called C++ object pointer is null
[TS-1481] - static analysis: logic error, dereference of null pointer
Bug
[TS-407] - traffic_server not using proxy.config.syslog_facility
[TS-898] - Fix potential problems from coverity scan
[TS-1475] - Static analysis: clean up all clang and coverity reports
[TS-1535] - FetchSM process_fetch_write should ignore event TS_EVENT_VCONN_WRITE_READY
[TS-1570] - remap doesn''t reject request whose Host has extra characters after port (like "test.com:80xxx")
[TS-2009] - Disallow \0 in all headers
[TS-2095] - autoconf warnings related to unordered_map
[TS-2883] - core dump in TSFetchCreate()
[TS-2938] - Core dump in HttpSM::redirect_request when handling 307
[TS-2959] - Compiler warnings from gcc 4.9.1
[TS-3020] - Blind Tunnel fake request URL is IPv4 only
[TS-3026] - SPDY not forwarding Accept-Encoding headers for Firefox
[TS-3035] - Double logging on errored transactions
[TS-3039] - OCSP stapling memory leaks
[TS-3042] - Fix the static traffic_server build
[TS-3048] - Removed hard coded directory in TSPluginDirGet Regresson Test
[TS-3051] - Bad if for perror on AIO.cc
[TS-3064] - Expose TS_EVENT_VCONN_ACTIVE_TIMEOUT in headers
[TS-3065] - Delete the header "Transfer-Encoding" when the error body was set
[TS-3066] - Latest master does not compile on OmniOS
[TS-3073] - tr-pass: non-http request gets blocked with error message instead of being tunnelled to the origin server
[TS-3074] - Regression fails on FreeBSD after TS-2736
[TS-3076] - Coverity warning and build error on RHEL6
[TS-3081] - ATS doesn''t send FIN flag to indicate data complete to the client in some cases..
[TS-3083] - Double free of FetchSM
[TS-3084] - Forwarding mode breaks iPhone activation (gs.apple.com)
[TS-3085] - Large POSTs over (relatively) slower connections failing in ats5
[TS-3087] - Flow control can stall at low water mark values
[TS-3092] - SSL_CTX_set_timeout should be set even if Server Side Session Cache is disabled
[TS-3097] - Reloading SSL certificates crashes
[TS-3098] - Fix the ability to configure keep-alive on post to the origin
[TS-3105] - Combination of fixes for TS-3084 and TS-3073 causing asserts and segfaults on 5.1 and beyond
[TS-3106] - ATS error responses do not flush request body
[TS-3109] - Build broken on ubuntu saucy64
[TS-3112] - core dump in FetchSM.cc
[TS-3120] - Overlapping rank in config.remap when using .include directives
[TS-3121] - Seeing garbage SPDY responses sometimes
[TS-3125] - SSL ctx is set to a constant allowing for potential inappropriate session reuse.
[TS-3129] - Parent proxy configuration does not work for incoming HTTPS requests
[TS-3130] - Core dump in Logging
[TS-3152] - We offer up H2-14 on current master, even when it''s not working / supported
[TS-3179] - ats_scoped_fd should not provide boolean operators
[TS-3184] - SPDY window_update not triggered correctly..
[TS-3188] - Do not set half_close flag for short post on keep_alive client connections
[TS-3189] - Do not start reading data on server to user agent tunnel too soon
[TS-3190] - Change producer_run() to run a specific producer in more cases
[TS-3191] - Confusion with HTTP_TUNNEL_STATIC_PRODUCER
[TS-3196] - Core dump when handle event check_inactivity
[TS-3199] - HEAD request over SPDY hangs until inactivity timeout
[TS-3202] - HTTP Parsing should not allow CTL characters in the method
[TS-3205] - ASAN complaints on config reload freeing malloc''ed memory with delete[]
[TS-3207] - _xstrdup incorrectly calls ink_strlcpy with zero length strings
[TS-3221] - ink_atoi64 return 0 for input of 0..9
[TS-3223] - Fix the internal buffer sizing.
[TS-3226] - SSL data not read from the socket sometimes causing transactions to timeout
[TS-3244] - stats_over_http plugin does not get the optional path argument properly
[TS-3248] - 5.2.0 Segmentation fault due to TS-3189
[TS-3254] - AdminClient.pm broken in v5.2.0
[TS-3257] - possible memory leak in v5.2.0
[TS-3261] - possible slow leak in v5.2.0
[TS-3262] - Build failure using clang on Fedora 21
[TS-3265] - core dump in spdy_prepare_status_response_and_clean_request
[TS-3274] - Cache fixup can cause race condition in ram cache.
[TS-3276] - Cache incompatible between 5.0.1 and 5.2.0
[TS-3280] - Segfault in new freelist bulk freeing
Improvement
[TS-1120] - Use ink_zero / ats_zero instead of calling memset when zeroing a variable or member.
[TS-2119] - mysql_remap plugin is in the source tree but does not build
[TS-2289] - Only support AIO_MODE_THREAD and AIO_MODE_NATIVE
[TS-2561] - Remove app-template from examples
[TS-2945] - Balancer plugin forward to other port than 80
[TS-2989] - ats_speed: implement In-Place-Resource-Optimization flow
[TS-3006] - Augment SNI callback processing
[TS-3023] - Support space separated values in inline plugin parameters in remap rules
[TS-3024] - Build with OPENSSL_NO_SSL_INTERN
[TS-3033] - Reimplement management protocol
[TS-3034] - Unanchored traffic_line metrics match
[TS-3041] - Add a way to show the installation layout
[TS-3044] - Linux native AIO should use eventfd if available to signal thread
[TS-3047] - The Makefile.am for traffic_top is inconsistent with the rest of the build system
[TS-3054] - Premature origin connection reset: flush partial data received to client before closing client connection
[TS-3068] - Remove usage of Boost
[TS-3069] - Add mysql_remap to automake
[TS-3070] - Consistent span configuration
[TS-3071] - Emit JSON numbers in stats_over_http
[TS-3093] - Add additional functionality to IpAddr.
[TS-3103] - Improve privilege elevation
[TS-3114] - Refactor IpMap to make the RB tree a shared data structure
[TS-3116] - Add support for tracking the use of the ioBuffers
[TS-3131] - Revise the certificates loading procedure
[TS-3135] - Disable SSLv3 by default
[TS-3143] - Convert DFA class to Regex and add support for JIT
[TS-3147] - Improvements to ESI plugin first byte flush feature
[TS-3150] - atscppapi should support streaming HTTP fetch
[TS-3154] - Add proxy port to access log
[TS-3155] - Add a value test method to the MIMEField class
[TS-3156] - Mutex[Try]Lock bool() operator change and unused API removal
[TS-3157] - standardize --help and --version options
[TS-3171] - Tidy up Tokenizer interface
[TS-3178] - ProxyAllocator improvements
[TS-3185] - Increase the default spdy initial_window_size_in setting to 1 mb
[TS-3194] - Remove unused proxy.config.plugin.plugin_mgmt_dir
[TS-3233] - Add drain option to restart API
New Feature
[TS-1432] - API is missing TSMutexDestroy
[TS-2314] - New config to allow unsatifiable Range: request to go straight to Origin
[TS-2417] - Add forward secrecy support with DHE (SSL related)
[TS-2503] - Dynamic TLS record size tuning
[TS-2682] - Add per remap configuration / activation to background_fetch
[TS-2683] - Add some control for which content to activate the background_fetch plugin
[TS-2955] - Support variable expansion in set-redirect operator for header_rewrite
[TS-2956] - Add ssl_pre_handshake hook for better plugin access to SSL handling and allow for combination of blind tunnel and tunnel proxying
[TS-3059] - Logging API is missing a TSTextLogObjectRollingSizeMbSet()
[TS-3080] - OpenSSL implementation of TLS session cache is very slow.
[TS-3101] - Add TSHttpHdrHostGet
[TS-3108] - Add port matching condition to header_rewrite
[TS-3115] - Add server response time field in custom logging fields
[TS-3119] - Add option to support SO_LINGER to origin server
[TS-3127] - Add config for OpenSSL session cache auto clear
[TS-3139] - Add script to "replicate" a response across a set of proxy caches (using PUSH)
[TS-3145] - traffic_line backtrace support
[TS-3149] - Move Via decoder out of traffic_line, and make a separate traffic_via tool
[TS-3192] - Implement proxy.config.config_dir
[TS-3195] - Improved crash logging
关于配置Apache反向代理以在生产中托管Laravel Echo Server和apache反向代理配置原理的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于apache - laravel中如何去掉URL中烦人的server.SegmentFault、Apache HTTP Server、IIS反向代理设置、Apache http server配置正向代理、Apache Traffic Server 5.2.0 发布,反向代理服务的相关信息,请在本站寻找。
本文标签: