I already have a Magento 1 site but now I want to set up an additional Magento 2 site on the same server with that Magento 1 site.
Is it possible to do this thing?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
There is a security risk to this. First start with...
As your question does not specify anything, I'll list some things that are necessary to achieve this:
You might have a problem with the right PHP version. M2 runs best on PHP 7, where M1 has some issues running on PHP 7. You can do 3 things here:
I would go for the last option, this would also increase the performance of your M1 instance
As I said, there's a security risk to it. This risk exists whenever you setup two applications on one server, so also with setting up Magento 1 and Magento 2 on one server.
Each application has it's security risks and it's known and unknown vulnerabilities/weaknesses. So do M1 and M2. As both applications are quite different, they both have different security issues.
Whenever you setup two applications on a server, the security risks of one application are also exposed to the other application and visa versa.
Or more specifically: If someone has successfully hacked your M1 application, the attacker also directly has access to the M2 application.
I would not advise you to do this. You should always setup only one single application per server.
Allthough 7ochem has written a very nice extended answer and had some legitimite remarks about this matter I believe it is perfectly okay to run both versions of magento on a single server as long as you split them up between two users of said server. The security issues in his answer are non-existent if both installations are setup correctly and separately. Ofcourse it's always advisable just to use the newest version of any CMS instead of a setup with both old and new. But it's definitely possible to set this up.
You can do this with docker and containers.