我正在尝试在 OSX 上设置 Apache,但无法使本地 url“awr.local”指向正确的路径。我的意思是,无论我输入http://localhost还是http://awr.local,它总是显示“localhost”虚拟主机路径中的 index.html 页面。我已经无数次重新启动了我的 httpd 服务,无论是否使用 sudo。
任何帮助将不胜感激,谢谢:'|
我一直在关注教程(https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions),以下是有关 Apache 的步骤:
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
brew install httpd
Run Code Online (Sandbox Code Playgroud)
# changed Listen 8080 to :
Listen 80
[...]
# changed DocumentRoot "/usr/local/var/www" to :
DocumentRoot "/Users/wallace/dev/default"
[...]
# changed <Directory "/usr/local/var/www"> to :
<Directory "/Users/wallace/dev/default">
[...]
# changed AllowOverride None to :
AllowOverride All
# uncommented :
LoadModule …Run Code Online (Sandbox Code Playgroud) 例如:
我有一个主要的临时域名
www.product.com
Run Code Online (Sandbox Code Playgroud)
对于每个客户端,我需要将单独的子域映射到具有相同端口(80)但具有不同实例名称(不同.wars文件)的相同服务器
www.client1.product.com
www.client2.product.com
www.clientn.product.com
Run Code Online (Sandbox Code Playgroud)
(纠正我,如果我错了)我知道如果我启动jetty实例,每个将从单独的端口no'开始
client1 war will start at port 3001
client2 war will start at port 3002
client3 war will start at port 3003
Run Code Online (Sandbox Code Playgroud)
我的问题是如何将端口80的所有实例映射到适当的相同子域
如果我访问
www.client4.product.com ,我需要在3004端口运行jetty app
更新:
为了更好地理解我的架构,如果在端口3002上运行的client2 jetty实例由于运行时异常或内存泄漏或手动重启而进入关闭状态,则所有其他独立运行的jetty实例(类似于google appengine背后的架构使用jetty)
我在我的Ubuntu 14.04机器上安装了Apache 2.4.7,我的一些虚拟主机不同意我的意见.我有5个虚拟主机,我正在尝试运行; 其中3个工作,2个不工作.两个不起作用的.conf文件是:
002-tmpnet.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/tmpnet
ServerName tmpnet
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html/tmpnet/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
#Order allow,deny
#allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
003-tmpcom.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/tmpcom
ServerName tmpcom
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html/tmpcom>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
#Order allow,deny
#allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log …Run Code Online (Sandbox Code Playgroud) 例如,我有两个域(app1.com,app2.com)和两个耳朵(app1.ear,app2.ear).每个EAR文件都包含ejb.jar和web.war.此外,每个WAR都有上下文根:/ app1或/ app2.
所以,如果我开始WildFly我会对运行两个应用程序本地主机:8080/APP1和本地主机:8080/APP 2.
如何将app1.com绑定到localhost:8080/app1和app2.com到localhost:8080/app2?
据我了解,我应该在standalone.xml中修改Undertow子系统配置.我试过了:
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="app1.com" default-web-module="app1.ear/web.war"/>
<host name="app2.com" default-web-module="app2.ear/web.war"/>
</server>
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
我不能配置Nginx与php-fpm正确.当我得到任何PHP脚本时,我404 Not found在浏览器中收到Nginx 错误:
File not found.
Run Code Online (Sandbox Code Playgroud)
在我的php-fpm日志中,我得到:
172.17.42.1 - 28/Apr/2015:09:15:15 +0000 "GET /index.php" 404
Run Code Online (Sandbox Code Playgroud)
任何PHP脚本调用和Nginx日志我得到:
[error] 28105#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.168.66.66:9000", host: "localhost"
Run Code Online (Sandbox Code Playgroud)
我的Nginx vitualhost配置是:
server {
listen 80;
root /var/www/html;
index index.html;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back …Run Code Online (Sandbox Code Playgroud) 是否可以在nginx中配置动态SSL证书路径,就像动态虚拟主机一样.
ssl_certificate和ssl_certificate_key不接受nginx中的变量.
谢谢
我有很多VirtualHost,似乎我们每次都需要做这两行:
<VirtualHost *:80>
...
ServerName www.example.com
ServerAlias example.com
Run Code Online (Sandbox Code Playgroud)
是否有允许这样做的单行解决方案?
<VirtualHost *:80>
ServerName *.example.com # works for both http://example.com and http://www.example.com
Run Code Online (Sandbox Code Playgroud)
即无需复制example.com?
我的网络服务器是这样设置的:
当我尝试运行 Certbot 时,它给了我这样的错误:
无法找到侦听端口 80 的虚拟主机,Certbot 当前需要该端口向 CA 证明您控制了您的域。请为端口 80 添加虚拟主机。
我查看了人们在他们的博客等上发布的其他答案......但它们不是专门针对 EC2 Linux AMI 的,或者比他们需要的更复杂。
它们中的大多数似乎与 /sites-available 或已启用有关...但主 .conf 文件中已经有一行指向其他 .conf 文件。无需在那里添加一行。
我有一些 PHP Web 应用程序在 macOS 10.15 上运行 XAMPP 7.4.1。XAMPP 过去曾为我工作过。我的开发环境搞砸了,因为 32 位应用程序与 Catalina 混在一起,而且我的旧 XAMPP 安装无法打开。我已重新设置虚拟主机,但现在当我尝试访问我的网站之一时,出现以下错误。
Access forbidden!
You don't have permission to access the requested directory. There is
either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
Run Code Online (Sandbox Code Playgroud)
我的虚拟主机如下所示:
# localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#####################
# PERSONAL PROJECTS # …Run Code Online (Sandbox Code Playgroud) “sudo systemctl enable --now docker”在运行此命令时出现类似“系统尚未使用 systemd 作为 init 系统 (PID 1) 启动。无法操作。无法连接到总线:主机已关闭”的错误“我该如何解决这个问题,而且我对 Ubuntu 命令还不熟悉。