简体   繁体   English

在ubuntu 14.04 vps上访问var / www文件夹

[英]access var/www folder on ubuntu 14.04 vps

I recently installed apache and php on a ubuntu vps and i'd like to be able to make web requests from an iPhone app to php files on the server namely files inside the www folder ex: 'var/www/myfolder/echo.php' by ways of a web request from the app to the URL 'http://ipaddress/myfolder/echo.php' or whatever the correct url is. 我最近在ubuntu vps上安装了apache和php,我希望能够从iPhone应用程序向服务器上的php文件发出网络请求,即www文​​件夹中的文件,例如: 'var/www/myfolder/echo.php'从应用程序到URL Web请求的方式'http://ipaddress/myfolder/echo.php'或任何正确的网址为。 I do not know the URL i need to type in to access the echo.php file. 我不知道我需要输入URL来访问echo.php文件。 can anybody shed some light on this confusing situation I'm in? 有人能阐明我所处的这种令人困惑的情况吗? ps. PS。 this is my first time working with servers 这是我第一次使用服务器

You need to check what your DocumentRoot is set to in your Apache configuration. 您需要检查Apache配置中将DocumentRoot设置为什么。

So if /var/www is the DocumentRoot , which is the default on Ubuntu, then your URL will be http://machinename/myfolder/echo.php , which is what you have. 因此,如果/var/wwwDocumentRoot ,这是Ubuntu上的默认值,那么您的URL将是http://machinename/myfolder/echo.php ,即您拥有的。

Before doing any coding on the iPhone, test the .php file in a web browser. 在iPhone上进行任何编码之前,请在网络浏览器中测试.php文件。

Any errors during development and testing, then check the Apache error log ( /var/log/apache/error.log ). 开发和测试过程中的任何错误,然后检查Apache错误日志( /var/log/apache/error.log )。

consult https://stackoverflow.com/a/23175981/2038460 solved my problem! 咨询https://stackoverflow.com/a/23175981/2038460解决了我的问题! i just had to specify the document root to actually be the folder i was working on, i though it'd be enough just having it at/var/www but apparently not, had to be /var/www/folder 我只需要指定文档根目录实际上就是我正在使用的文件夹,尽管将它放在/ var / www就足够了,但显然不是,必须是/ var / www / folder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM