I'm currently developing a RESTful api as a bridge between my ios/web application and their shared database, and content.
I found my way to implement RESTful api in PHP on this blog.
I started my development on my OVH Apache-based server. Unfortunately, they didn't provide oauth support on web hosting services and there is no way to install it. OVH told me I needed a dedicated server or a VPS server for this.
Now, I'm going to work on dotCloud. It's a great alternative, I think, but their servers (seemingly Amazon EC2's ones), are nginx-based.
This would be the first time I've used a nginx server and I need your help for "translating" this .htaccess to a nginx.conf file.
Before asking for your help, I tried to find a nginx.conf file for this but no one worked.
When I pushed them to my dotcloud app, the http service of my app crashed and dotcloud cli said :
14:55:44 [www.0] WARNING: The service crashed at startup or is listening to the wrong port. It failed to respond on port "http" (80) within 30 seconds. Please check the application logs.
Thanks for any help in advance :)
Thanks to this htaccess to nginx.conf converter, and some tricks and tests I've made, here is the corresponding nginx.conf file.
I hope it will help people. ;)
EDIT: link to my configuration is dead, but the converter is still available. As long as you have a valid Apache configuration you're good to go.
Related
I just started up an Azure server and have been trying to access it for a while and am having a hard time doing so.
I installed zPanel on my 12.04 Azure Ubuntu server (like cPanel: Apache, MySQL, PHP, etc) and made sure Apache was working and pointed a domain to the server IP and gave it to zPanel's installer to config.
I tried accessing the server through direct IP, through the domain and even pinging it. I keep getting Request timed out.
I'm using the "Resource Manager" in Azure and can't find a way to specifically allow port 80, so I'm assuming it's enabled already, but that's the only reason I can think of for not being able to access the server. Any ideas?
Try to add the specifical port on the Azure old portal or new portal, please see the pictures below.
Fig 1. Add the endpoints(ports) on Azure old portal
Fig 2. Add the endpoints(ports) on Azure new portal
Hope it helps. Best Regards.
I am developing APIs in node js and have hosted the application on amazon EC2. In a third party API it is required to host a php page on our server and give its public url back to them. Is there another way to host it apart from a LAMP setup? Anything apart from EC2 is also fine but please take into consideration that this is a single page having some logic and nothing else will be there in PHP.
I work with node and php. I would recommend NGINX. It's configuration files are really simple and it's much lighter-weight than apache.
You can simply create a redirect/rewrite directive in NGINX that will pass your php page to the node server instead and be done. For this usecase, you wouldn't actually even need to install or configure the PHP backend.
http://nginx.org/en/docs/beginners_guide.html#proxy
You might also check AWS domain management tools (AWS Route 53). There may be a way to directly rewrite the incoming PHP request to go to your node app instead without installing any webserver on your EC2.
Yes, there are other web-servers available apart from apache: For instance Nginx plus or Lighttpd, both are fine and lightweight alternatives to host your PHP files on EC2.
Though, it's not clear to me why don't you like the LAMP setup. Maybe Apache+PHP, without MySQL, would be enough for you?
I'm developing a php application. I'm using wamp and I'm behind a corporate proxy. I'm using cntlm to authenticate NTLM. I need to curl google geocoding api, in order to do this I used the following settings that are working:
curl_setopt($ch,CURLOPT_PROXY, '127.0.0.1:3128');
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
I'd like to find a way to avoid setting those options for CURL. I believe I can play with Apache setting, but I'm not sure. The reasons I need to find this solution are:
In production env there will be no such a proxy (at the moment the above options are used only if the environment variable is set to DEV env, but still: it's not the best solution)
If I want to use 3rd party SDK (such as facebook php sdk), those are internally using CURL but they do not necessarily expose method to change CURL options (for example facebook sdk doesn't). I don't want to change the SDK source code to fit my proxy
What I tried:
So far I turned on proxy_module on apache and I added the following line on httpd.conf, but with no success
ProxyRemote * http://127.0.0.1:3128
I still can't access the internet. I googled a lot, but I couldn't find a solution, any ideas?
I could find many people talking about the same issue, but I didn't find any comprehensive solution, for this reason I raise a bounty.
What I found:
There is this bug in which I found: But I'm not sure if this will work for curl and anyway I can't find how to modify the php.ini
[2010-12-20 14:03 UTC]
jani#php.net
-Summary: changing the default http-wrapper
+Summary: Add php.ini option to set default proxy for wrappers
-Package: Feature/Change Request
+Package: Streams related
-PHP Version: 5CVS
+PHP Version: *
and
[2011-04-05 11:29 UTC] play4fun_82 at yahoo dot com Hi, i have the
same problem. My solution was to pass through proxy server with cntml
tunneling tool. You configure cntml proxy to forward http request
received on local host on a port to destination with proper
authentication.
And in pear u just configure
pear config-set http_proxy 127.0.0.1:3128
3128 - is port configuret in cntlm(it can be any other free port).
Thanks very much
You're saying you want this functionality on WAMP, for your development computer only, right? The SDK's work without modification in production, so you can just take advantage of your Window's Host file to redirect requests.
Here's a walkthrough.
After reading this article I was about to throw in the towel, but there is actually an easy solutiuon. I had to play with windows environment variable, at the end setting a system variable to https_proxy=https://localhost:3128 worked! Before it was not working because I was setting it to 127.0.0.1:3128. Run the command
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | find /i "proxyserver"
then copy/paste the answer in the system variable and now it's working!!
I think you can do it through proxy tools like Proxifier(http://www.proxifier.com).
AFAIK, they can capture traffic from selected applications and redirect to a proxy automatically.
Not a perfect solution but should be useful on dev machine.
A few days ago I setup this WebSocket server from http://code.google.com/p/phpwebsocket/
It works excellent on my localhost by using Xampp. Then, I uploaded it to my webspace on Strato, but now I am not able to connect to the server.
I changed the the sockets connection to my domain but it didn`t work
Client.html:
var host = "ws://xxxxxxxx.com:12345/Websocket/server.php";
Server.php:
$master = WebSocket("xxxxxx",12345);
I already tried it with different port(80,443,12345,8080,8000....), using the IP address in server.php instead of the domain.
I also used absolute and relative paths in the client.html.
From the projects page http://code.google.com/p/phpwebsocket/ someone suggested to use 0 or 0.0.0.0 in the server.php, but that didn`t work either.
In the client.html it just shows:
WebSocket - status 0
Disconnected - status 3
My guess that the problem is that Strato is blocks me from using WebSockets.
Is it possible to run WebSockets on my webspace?
My bet is that your host is blocking incoming requests to the socket. Your not supposed to run scripts like phpwebsocket within a web service (it is a server itself). This confuses a lot of people since PHP is typically used for scripting webpages, not for coding daemons.
I say this because you mentioned running the script within Xampp, and referred to your hosting service as 'webspace'.
If this is the case you will have to upgrade to a virtual server package so that you can run your own services.
Okay, to bring this to an end.
I found a solution to use my websockets app and I´ve got an explanation why it did not work on my shared hosting solution.
I contacted Strato who told me that they don`t allow Websocket on shared hosting. The only way to get a similiar result would be to use AJAX Long Pooling.
Now I purchased to a Virtual Server and my websocket app works great now.
Thanks for your support.
I'm working on a project that is located on 2 domains within same server:
1. DataSource system, which provides data for main app
2. Main app, providing the data for front-end app.
App 1 needs to work on seperate domain, as it's data source for more applications. I'm trying to find some way to boost communication performance. Simple call from app 2 to app 1 takes approximately 0.3-0.4s.
Is there anyway to force server to bypass TCP/IP communication and call service directly from localhost?
Both applications are written in PHP with Zend Framework. The server is IIS. Both applications are based on SOAP solutions.
Would appreciate any tips. Will provide additional information if needed.
Thank you in advance for any help.
You have a misunderstanding here. If you call services from localhost (i.e. via Zend_HTTP_Client), this means you are using the tcp/ip and http layers here. Everything works via sockets, no matter if localhost or external ip address.
If the other application needs to be accessible "from the outside" (no integration possible) you can imho only speed up by using a faster webserver (e.g. nginx), turning off modules in your webserver that you don't need or writing your own socket server, dismissing a whole lot of the processing apache and nginx do. http://devzone.zend.com/209/writing-socket-servers-in-php may help you with your first steps.