This time due to the server architecture, it is necessary to study the deployment of PHP programs on Java-based jetty (Wordpress,discuz)
In the online search for a lot of information, are used httpd or Nginx current segment of the Web Server,jetty server in the background. The embedded jetty (embedded jetty), which I used before, is not suitable for this solution.
Later search again, found that jetty originally has this support:
Http://www.eclipse.org/jetty/documentation/9.2.7.v20150116/configuring-fastcgi.html
Http://lutaf.com/141.htm
https://gutspot.com/2014/06/24/%E6%B5%8B%E8%AF%95jetty%E7%9A%84fastcgi%E6%94%AF%E6%8C%81/
Since the official description gives the configuration in the form of XML, I turn it into the following Java form, where it is important to note that two servlets are set to asyncsupported = True, otherwise jetty will error
PublicWebappcontext Phpwebappcontext ()throwsException {String root= "/root/php/yourphpscriptlocation"; Webappcontext CTX=NewWebappcontext (); Ctx.setcontextpath ("/php"); Ctx.setresourcebase (root); Ctx.setwelcomefiles (Newstring[]{"index.php"}); Servletholder Defaultservletholder=NewServletholder (Defaultservlet.class); Defaultservletholder.setasyncsupported (true); Ctx.addservlet (Defaultservletholder,"/"); Servletholder Proxyholder=NewServletholder (Fastcgiproxyservlet.class); Proxyholder.setasyncsupported (true);Proxyholder.setinitparameter ("Proxyto", "http://localhost:9000");Proxyholder.setinitparameter ("Scriptroot", Root); Proxyholder.setinitparameter ("Scriptpattern", "(. +?\\.php)"); Ctx.addservlet (Proxyholder,"*.php"); returnCTX; }
It is then started on the server and can be downloaded to the package manager that comes with the server.
I started after everything is normal, no error, but the results of the display page has been 404 File not Found. I checked for a while and felt the settings were all right, and PHP-FPM's access log was successfully displayed to the request.
What is the reason?? Check for a long time, in the PHP-FPM configuration file see this paragraph (sample configuration file can be seen here: https://github.com/perusio/php-fpm-example-config/):
; Unix User/group of processes
; Note:the user is mandatory. If The group is not set, the default user ' s group
; would be used.
user = Apache
Group = Apache
When I found out that the main and child processes were running Apache, I was under curiosity to change two to root and then run with Php-fpm-r (-R is allowed to run with root)
A try, unexpectedly good!
Really faint, no access unexpectedly also do not prompt error, say file not found ....
Faint.
Deploying fastcgi servlet in Embedded Jetty (Embedded Jetty) Loading PHP programs