Running node, PHP and Python on the same vps [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Is there a rational way to serve multiple websites via PHP:Nginx, Python:??? & node.js on the same vps?
And would it be reliable?
The sites are expected to be low in traffic.
I currently have PHP running on Nginx, Ubuntu via Digital Ocean and I would like to stick to Nginx for PHP and any major webserver for Python.

The kind of setup you're describing is straightforward and not complicated. Nginx works fine as a reverse proxy and web server that handles serving static assets.
For PHP, you just need to proxy to php-fpm (running on a TCP port or unix socket).
For Python, you need a wsgi server (something like uwsgi or gunicorn, again using a TCP port or unix socket) to server the Python app and have Ngix proxy to requests to it.
For your Node.js app, just run the node server on a port like 8000 and have Nginx proxy requests to it.
If you have a bunch of websites, each should have a server block matching a unique server name (i.e. mapped to a virtual host).
The setup is as reliable as your backend services (like php-fpm, wsgi, and Node.js server). As long as those services are up and running (as daemon services) nginx should have no problem proxying to them. I have used all 3 setups on one server and have never experienced problems with any of the above.

Related

php7.4, php7.4-fpm, http2, Apache, nginx, I'm confused [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Can I use php7.4-fpm with Apache? Or is php-fpm really only for use with nginx? And why?
Does php7.4 support http2? Or do you still need php-fpm? The official http2 site (http2.pro) hasn't been updated in a couple of years.
Is it Still worth activating HTTP2? (The latest update dates back to a couple of years ago.)
To activate http2 I followed all the procedure described here: https://http2.pro/doc/Apache, now if I have to reactivate php (normal) how do I go back?
(The question was initially much more explanatory, but the administrators didn't like it ... they ask for it to be more focused, so let's try with only the questions.)
PHP-fpm is a version PHP that talks to the outside world with a protocol (a style of communication) called FastCGI. Apache can also talk via fastcgi to the servers it uses to answer requests - in both Nginx & Apache via the php-fpm: master process, that organises the pool of workers that actually run the PHP code. Since Nginx doesn't have mod_php, the only significant way to have it run PHP code is with php-fpm (there are some other methods, but they are not so often used)
HTTP2 is something for the webserver to deal with - Apache, or NginX. PHP doesn't need to worry about it, unless you want to send additional headers that the webserver would then deal with on its behalf (like also sending CSS or .JS files along with the initial connection - this is called HTTP-push, but it's not yet well widely established).
HTTP2 it totally worth it - you will, however, use this alongside the older http v1.0, or v1.1, but it is more efficient for browsers that support it.

What should I do to execute php scripts on my own web server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to create own web server to accept HTTP requests and send response to client.
I have idea to call PHP scripts by CLI interface but then PHP scripts executed in CLI mode. What I need do for call scripts by my own server (not in CLI mode)? Because in CLI mode some PHP abilities is disabled. Maybe I need to write own PHP SAPI?
Please help me to start.
Thanks
No, you don't need to write your own PHP SAPI, as there has already been one written specifically for interfacing with a web server. It's called FastCGI.
It's important to note that PHP is both extensible and embedded by design. So, while some SAPIs like the Apache 2.0 Handler (a.k.a mod_php) might be embedded in the httpd server directly, it is not typically necessary to do so in order to have the web server talk to PHP.
The difference is you still need some process to manage the underlying PHP interpreter and deal with things like recycling workers or managing the number worker processes available for the webserver to talk to. For example, php-fpm does this quite nicely and many people use php-fpm to manage the PHP workers and just tie that to their webservers like nginx or httpd via the fastcgi protocol. The PHP workers forked by php-fpm listen on a fastcgi socket and the webserver can freely send and receive information from and to PHP.

Any way to avoid restarting httpd to apply a user's php.ini file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have a shared hosting server hosting lots of different accounts (domains).
Server is standard LAMP stack using webmin/virtualmin to administer/create accounts.
Each domain has its own /home/[account]/etc/php.ini file. This allows settings to be adjusted for each account individually. For example, Display_Errors can be set in this file.
However, if any changes are made to the php.ini file for a specific account, the whole httpd process must be restarted, affecting ALL hosted accounts, in order to apply the settings. End users don't have permissions to do this, obviously, so I have to do it for them. Is there any way to apply individual php.ini files to that particular domain without needing to restart the httpd process?
Note: end users don't have SSH access.
Thanks!
Use
service apache2 reload
instead of
service apache2 restart
Substitute apache2 for httpd or whatever your specific system's configuration entails. service is usually an Ubuntu thing; other systems invoke services in different ways. The key terms here are restart vs. reload.
If you are not using libapache2-mod-php, and are instead using ProxyPass or PHP FPM, substitute the above with
service php5-fpm restart
Since end-users don't have SSH access, you'll either need to build some sort of interface for them to reload the server, or reload the configuration upon modification or with an interval.
This is generally achieved using a CRON job.

Can you run Ruby and Rails and PHP together on the same site? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Why? Because for our site I want to develop a Rails application, but I also want a separate part of it (perhaps the public directory) to be easy to modify by a PHP programmer/web designer.
Is it possible to run both on the same site? Are there any reasons why it is not a good idea or not a best practice?
I am pretty sure Nginx and Lighttpd can do it. For example, you can run php worker processes with php-fpm and configure the webserver to send any php jobs to them. Every other job could be configured for rails. I have never tried it myself.
You can use the vhost, port, or file extension (*.php) to determine where the webserver will send the request.
I think it would be an ok idea if lets say you have a PHP site but want to have a non-blocking application in nodeJS or use Tornado and have Nginx configured to proxy requests to them.
Example where Nginx is used for PHP-FPM and Node.js
http://blog.mixu.net/2011/01/04/nginx-php-fpm-and-node-js-install-on-centos-5-5/
In this example Node is ran on port 8000

Node.js + Socket IO + Apache + PHP cheap webservers? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am new to using node.js and socket io and I am currently hosting my php website on a server, now that I am going to be adding node js and socket io to my website I will need hosting that will allow me to have those, are there any out there or will I need to have my own? I am hoping to have a cheap hosting service as this is just to have my site hosted while in development, once I am finished with it I plan to have my own server set up.
I recommend DMEHosting as a VPS to use for development. Their cheapest Linux VPS is more than affordable and serves your purposes. It will also get you into the basics of setting up a web server on Linux via SSH, which is essential. I recommend reading up on an article on setting on a VPS on Cent OS. Just Google that. You don't really need to learn how to use Linux for now. Just know how to navigate directories and follow tutorials on setting up your own web server.
Edit: Keeping this post as is for historical purposes, but I now recommend an EC2 instance or DigitalOcean.
Here is a list of Node hosting solutions. However, if you want to be able to have Node.js + PHP and Apache, you will need to use your own server, like a VPS. Popular options are Linode, Slicehost, Amazon EC2 and Fanatical. Note that the VPS option will require good knowledge of Linux.

Categories