我是初学者Ruby on Rails程序员,我正在尝试安装Apache2 + Passenger(这是用于Rails部署)..在安装过程结束时,Passenger给了我几行代码添加到文件apache2.conf在/ etc/apache2 /但是我无法覆盖这个文件..我没有权限=(我还上传了一个显示错误的图片.
PS =>我用我的用户名和密码登录Ubuntu.
请帮忙!谢谢,罗德里戈.
所以我在Apache中配置了fallbackresource,将请求发送到webroot中的index.php,除非我在webroot目录中调用一个不存在的php文件,否则它似乎有效.例如,如果我尝试获取不存在的"/a.php",则会出现404错误.但是,如果我调用"/nodir/a.php",它会按预期将其发送到index.php文件.
我搜索了谷歌并阅读了该功能的Apache文档,但还没有找到为什么会发生这种情况.
我的安装服务器版本:Apache/2.2.20(Ubuntu)在目录部分下使用带默认配置的默认网站"FallbackResource /index.php"
有任何想法吗?
我可以使用mod_rewrite在.htaccess中使用以下基本行来正常工作,但显然更喜欢FallbackResource:
(.htaccess in webroot)
RewriteEngine On
RewriteCond /var/www/%{REQUEST_FILENAME} !-f
RewriteCond /var/www/%{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /a.php HTTP/1.1
HOST: localhost
Connection: close
HTTP/1.1 200 OK
Date: Sat, 31 Dec 2011 02:37:48 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.3
Vary: Accept-Encoding
Content-Length: 43
Connection: close
Content-Type: text/html
/a.php
localhost
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud) 我已经使用Apache2 + Passenger在VPS上部署了我的RoR应用程序.配置应用程序后,当我点击从浏览器提交请求时,我的apache2/error.log中出现"cache:[GET /] miss"
请帮助我理解为什么我会收到此错误.我一直在努力解决这个错误一天或两天.
谢谢,约翰
看起来我使用了错误的模块版本apxs2.
一旦它被禁用(a2dismod),我该如何删除它,以便我可以安装正确的版本?
看似基本的,但......不知怎的......我在Google,IRC等上找不到任何东西.
我的网络服务器上运行了几个webapp:
https://beta.mydomain.tld/svn/reposhttps://beta.mydomain.tld/trachttp://beta.mydomain.tld/端口8080上的本地Apache Tomcat的代理访问请注意,前两个可通过SSL获得,第三个不是(尚未).现在我需要通过https提供我的网络应用程序,但我希望Trac和SVN浏览器仍可在其当前位置访问.
即我想配置的Apache2代理所有请求没有开始svn或trac到Tomcat.
对于现有的SSL Web应用程序,有以下配置
<Location /svn/repos>
DAV svn
SVNParentPath /home/myuser/svn
SVNListParentPath on
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /home/myuser/.htpasswd
Require valid-user
</Location>
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /home/myuser/trac
PythonOption TracUriRoot /trac
AuthType Basic
AuthName "Trac"
AuthUserFile /home/myuser/.htpasswd
Require valid-user
</Location>
Run Code Online (Sandbox Code Playgroud)
我试图添加以下位置,但它没有任何帮助...
<Location />
ProxyPass http://localhost:8080
ProxyPassReverse http://localhost:8080/
</Location>
Run Code Online (Sandbox Code Playgroud)
有关更多信息,这里是关于SSL部分的完整apache2配置(没有任何我失败的试验 - 我认为它是默认的trac配置):
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName beta.mydomain.tld:443
DocumentRoot /var/www/
<Directory /var/www/>
Options Indexes …Run Code Online (Sandbox Code Playgroud) 我在Tomcat中运行了一个Web应用程序http://<server>:8080/app/portal/.我希望世界通过URL看到这个应用程序http://<server>/portal/.
为此,我使用Apache 2.2设置了反向代理.根据ProxyPass的文档,我希望反向代理透明地传递所有请求.我的浏览器永远不应该知道Tomcat URL.
这是我的配置:
没有虚拟主机,我将这些行添加到我的httpd.conf中
<Location /portal/>
AllowOverride All
RewriteEngine On
ProxyPass http://server:8080/app/portal/
ProxyPassReverse http://server:8080/app/portal/
</Location>
Run Code Online (Sandbox Code Playgroud)
当我使用Firefox打开时http://<server>/portal/,我得到一个302 Moved Temporarily,所有后续调用从我的浏览器直接进入http://<server>:8080/app/portal/.我的浏览器指向此URL.
这不是我对反向代理的期望.我的配置是错误的还是我误解了反向代理的目的?我该怎么办才能达到理想的行为?
我在Apache/2.4.2-win32服务器上有以下.htaccess:
# Turn mod_rewrite on
RewriteEngine On
# Allow direct loading of files in the static directory
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?static/(.+)$ - [L]
# Send all other requests to controller
RewriteCond ${REQUEST_URI} !^/?(spf/index\.php)?$
RewriteRule .* spf/index.php [L,QSA]
Run Code Online (Sandbox Code Playgroud)
这很好用,完全符合我的要求.对于那些无法解决问题的人来说,它会发送所有请求,spf/index.php除非它们是针对目录中存在的static文件.
该文件驻留在虚拟主机的文档中.
通过此.htaccess发出的每个请求都会生成以下错误:
[Wed Aug 01 14:14:16.549835 2012] [core:warn] [pid 7100:tid 1076] AH00111: Config variable ${REQUEST_URI} is not defined
Run Code Online (Sandbox Code Playgroud)
这实际上并没有导致问题 - 每个请求都按预期工作 - 但它填满了我的错误日志,我不喜欢它.
根据谷歌的说法,之前从来没有人犯过这个错误.就我调试它而言,我真的不知道下一步该去哪里.
任何人都知道这里发生了什么?
PS我知道这可能是一个更适合SF的问题,如果一般意见是它不属于这里我会移动它.
我有一个Web应用程序,除其他外,将查询数据库并使用数据创建Excel电子表格.在将文件发送到客户端计算机之前,我需要将电子表格保存到服务器的磁盘.我正在使用Flask框架和openpyxl来生成电子表格.在Flask的开发服务器上运行时,一切正常,但真正的服务器是带有WSGI的Apache2.当我在那里运行时,在尝试保存电子表格时会引发"权限被拒绝"错误.我不知道在Apache/WSGI中运行时Python的工作目录是什么.
有没有办法,可能在WSGI配置文件中,更改工作目录,或以某种方式控制它将保存到哪里?如果可能的话,我想使用相对路径进行保存(它使代码更具可移植性),这就是更改工作目录是最佳解决方案的原因.
我正在使用mod_wsgi在Apache2上部署我的web.py应用程序.
这是我的virt_host文件,
WSGIPythonPath /home/ubuntu/plotwatt/libplotwatt:/home/ubuntu/plotwatt/pwstage/src
<VirtualHost *:20108>
ServerAdmin gslabrails.dev.plotwatt.com
DocumentRoot /var/www
WSGIScriptAlias / /var/www/currentcost/server.py
WSGIDaemonProcess currentcost user=ubuntu group=ubuntu processes=5 threads=3
WSGIProcessGroup currentcost
WSGIApplicationGroup %{GLOBAL}
AddType text/html .py
<Directory /var/www/currentcost/>
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/currentcost_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/currentcost_access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我在WSGIPythonPath中给了我名为redisStage的lib的路径.但是,它似乎不适合我.我做错了配置吗?我不能把WSGIPythonPath指令放在VitualHost指令中.究竟是什么原因?
我已经安装了Apache 2,它工作正常.我已经安装了PHP 7,一切正常,但是当我安装phpMyAdmin时,Apache 2停止工作.检查Apache 2时,它甚至不会加载默认页面.
当我重新启动Apache 2时,出现以下错误:
root@ip-172-31-30-202:~# service apache2 restart
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
Segmentation fault (core dumped)
Action 'configtest' failed.
The Apache error log may have more information.
Run Code Online (Sandbox Code Playgroud)
错误日志包含:
[Mon Jul 18 12:54:10.668017 2016] [mpm_event:notice] [pid 13665:tid 140077033654144] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Jul 18 12:54:10.668089 2016] [core:notice] [pid 13665:tid 140077033654144] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jul 18 12:54:23.642421 2016] [mpm_event:notice] [pid …Run Code Online (Sandbox Code Playgroud) apache2 ×10
apache ×2
mod-wsgi ×2
ubuntu ×2
.htaccess ×1
httpd.conf ×1
mod-proxy ×1
mod-rewrite ×1
passenger ×1
permissions ×1
php ×1
proxypass ×1
python ×1
pythonpath ×1
server ×1
uninstall ×1
virtualhost ×1