Is it possible to run symfony2 development server with ssl connection? - symfony

I am developing my new project in symfony 2 in built-in Symfony2 sever (app/console server:run). Is it possible to run my website with https on this server?

now it is possible using the symfony cli, you can install a ssl certificate
symfony server:ca:install
https://symfony.com/blog/local-web-server-reloaded-for-symfony-apps
To install symfony client if you are on a Mac run:
curl -sS https://get.symfony.com/cli/installer | bash
Otherwise check this link for other OS: https://symfony.com/download

The php app/console server:run use the PHP built-in web server that was designed to aid application development and isn't supposed to support SSL, just plain HTTP requests.
You can try to use this https://stackoverflow.com/a/12946566/3059764

Related

SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8080

I am windows developer trying to use Camunda model rest API client project.
I did download the sample from the GIT which has examples for Camunda samples using WPF.
https://github.com/mtringuyen/camunda-dot-net-showcase
However there seems to be some sort of socket exception.
IIS is installed. I also verified versioning of .NET STANDARD and .NET FRAMEWORK. They are compatible.
Any suggestions to resolve this error?
Thanks in advance
The project you are using only contains
a .NET tasklist implementation used by people to participate in the business processes.
.NET implementation of automated task workers, which are used to do system integration from .NET (See: https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/)
The Camunda server remains a Java application. However, you can start it and use it as a blackbox from .NET without Java knowledge. There are several distributions. If you are not familiar with Java you should either use the Docker image:
docker run -d --name camunda -p 8080:8080 camunda/camunda-bpm-platform:latest
or a prepackages Tomcat using the Camunda RUN distribution.
You can download a server here: https://camunda.com/download/
Also see: https://docs.camunda.org/manual/latest/installation/
If you think an application that is running is listening on a particular port a quick way to check would be to run a command prompt as administrator and do a netstat -ab . This will show you all the ports that are listening on your local device. Obviously your example requires something listening on 8080 so fire up whatever application that is supposed to be and double check it.

Symfony CLI server use of mkcert certificates

I am currently using Symfony with react and webpack to build an application. I use the Symfony CLI development server. I would like to turn this application into a Progressive Web Application (PWA) according to the cookbook at PWA Workshop. However, according to the information I'm gathering, a fully trusted SSL certificate is required for mobile testing, etc. and the use of mkcert is recommended (or maybe Let'sEncrypt). I've already followed the process to enable TLS on the Symfony CLI server. However, the certificates generated appear to be self-signed and are not a fully trusted. Is there a way either call the trusted mkcert certificates from the Symfony CLI server command line or reference them in Symfony config files so that the server uses them instead of the self-signed ones generated by the symfony server:ca:install command? (mkcert appears to generate two .pem files and other non-php development servers such as http-party/http-server can call them direct from the command line.) My work around is to configure my local apach2 server with the certificates, but I'd like to keep using the Symfony server for debugging.
UPDATE
I failed to mention that my development environment is WSL2 on windows 10. That seems to be the problem with getting trusted certificates to work. Since the browsers run in Windows and the servers run in WSL, the windows browsers don't accept the certificates. My current work around for mkcert and apache2 running on WSL is to:
Install mkcert on both WSL and Windows, Running mkcert -install in both WSL and Windows,
Copy the windows root certs from the Trusted Store created in Windows to the Trusted store created in WSL. You find these stores in both environments by running mkcert -CAROOT in the respective environments,
Run mkcert localhost 127.0.0.1 and add cert pair to a folder somewhere according to mkcert's instructions,
Then configure apache2 to use SSL and the mkcert cert pair according to instructions found all over the internet.
I found this workaround at mkcert solution.
However, this issue still remains for the Symfony Server. It is unclear where the certificates (root or otherwise) are installed when symfony server:ca:install is run and whether there is a way to make copies of those certificates such that the servers can be run in WSL and windows will accept them. Also, the Symfony docs don't indicate whether those certs are just self-signed or if they are trusted root certs like mkcert.

Difference between symfony server and bin/console server?

I want to use the Symfony web server for local development, but I'm surprised that Symfony actually comes with two servers:
the Symfony local web server - started with symfony server:start
the Web Server Bundle - started with bin/console server:start
I find it very confusing to have these 2 options, as the docs do not seem to give you any hint as to why you should use one over the other and under which circumstances.
As far as I can see, it looks like the Web Server Bundle (bin/console server:start):
is just a wrapper around PHP's built-in web server
is installed using Composer
while the Symfony local web server (symfony server:start):
is a full-fledged web server
must be installed as standalone (as part of the symfony command)
Still, I can hardly understand why they do release these 2 options. At first glance it looks like the Symfony local web server is more powerful; in this case why would they release the webserver bundle as well?
As mentioned in the Web Server Bundle docs:
Deprecated since version 4.4: This article explains how to use the WebServerBundle to run Symfony applications on your local computer. However, that bundle is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.
Instead of using WebServerBundle, the preferred way to run your Symfony applications locally is to use the Symfony Local Web Server.
So the recommended way is to use symfony server:start to serve an app in development.
Thanks to #Cerad and #Jakub Matczak for their comments.

JavAPNS Runs Locally but not on Centos

Problem
I am experiencing a problem setting up Apple APNS on centos.
I have my Apache tomcat deployed and working fine. Also I am using Javapns to send push messages.
My Push notifications are working fine on windows, (within eclipse and on Apache standalone). but once I deploy the application to the server(centos 6) I get the Error:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
I am using a p12 certificate that works perfect on Windows as I said. but with no luck on Centos.
Environment:
Apache Tomcat with a Spring 4 deployed webapplication. running on centos 6. with Java 1.7.57.
Using Javapns of course for initiating the Push notifications. And I think it is worthy to mention that my P12 certificate is placed inside the WEB-INF/certs/certificate.p12.
-I do not have a SSL certificate for my webserver.
My Questions:
despite the fact that Javapns documentation states that Javapns is designed to work as part of a webapplication or even standalone, Is there any special configuration I have to modify on the server to allow my Service to run?
What is confusing me is that the same p12 certificate works locally but not on linux?
Is this something related to security chains on the server? or settings of Apache tomcat to allow such service to run?
I tried almost everything, posting this as I feel really stuck with this problem.
Thank you in advance.
When using APNS your server is connecting via SSL to the Apple APNS servers. The message you're receiving means that your used Java environment isn't aware of the issuing certificates - and hence cannot build the trustchain to validate the server certificate.
Check first with the following command <javabin>/keytool -list -keystore <javahome>/jre/lib/security/cacerts if you find the Apple certificates in the JVMs keystore.
If you don't find the Apple certs in there you can import them using this command.
<javabin>/keytool -import -noprompt -trustcacerts -alias <an_alias> -file <the_cert_file> -keystore <javahome>/jre/lib/security/cacerts -storepass changeit
You'll get the Apple root and intermediate certificates here: https://www.apple.com/certificateauthority/
Thank you muenzpraeger for your suggestion, but it was not the solution.
I could solve this through the great post found on http://cloudfields.net/blog/ios-push-notifications-encryption/
The problem as stated is related to authenticating the certificate to do communication over SSL. I had to command-line the Apple APNS certificate. and things worked like magic.
I am happy though for what you have posted as it lead me to read more about keystores.
Thank you for your help.

Configure Nginx to use cherrypy framework

I'm looking to use Nginx as the server and CherryPy framework on a linux server. I'm not looking to use Nginx as a reverse-proxy. I am moving away from PHP to python and i have a lot of cherrypy apps.
CherryPy wiki states that "CherryPy can be a web server itself or one can launch it via any WSGI compatible environment" I do not want to use the server part of cherrypy just the framework.
Does anybody know how to configure Nginx WSGI to use CheryPy?
You can use uwsgi for serve the cherry application.
check this link:
http://nileshgr.com/2012/08/27/getting-cherrypy-working-with-uwsgi

Resources