I'm using Laravel and when I uploaded the project to the server it returned 500, 503 and other types of errors. Because I'm using Virtualmin
I checked the error_log in /var/log/virtualmin
and I found that php-fpm
hadn't enabled. So I enabled that and get File not found
error on all pages now!
So I added ProxyErrorOverride on
into /etc/httpd/conf/httpd.conf
file but then got Not Found
The requested URL /index.php was not found on this server.
I commented it and added <FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
but again it returned File not found
.
Then I went into /etc/php-fpm.d/www.conf
and edited this part from ;chroot =
to chroot = /home/mysite/public_html/public
. But no result :(
UPDATE
I don't have any .htaccess
file in root folder but in public folder and inside this I have:
<IfModule mod_rewrite.c>
Options +SymLinksIfOwnerMatch
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
UPDATE 2
UPDATE 3
I modified /etc/php-fpm.d/www.conf
from this:
user = apache
group = apache
to this:
user = php-fpm
group = php-fpm
from this:
listen = 127.0.0.1:9000
;listen = /run/php-fpm/www.sock
to this:
;listen = 127.0.0.1:9000
listen = /run/php-fpm/www.sock
and vice-versa.
from this:
listen.owner = apache
listen.group = apache
to this:
listen.owner = php-fpm
listen.group = php-fpm
from this:
;listen.acl_users = apache,nginx
to this:
listen.acl_users = apache,nginx
from this:
;listen.allowed_clients = 127.0.0.1
to this:
listen.allowed_clients = any
from this:
;chroot = /
to this:
chroot = /home/mysite/public_html
from this:
;chdir = /
to this:
chdir = /public
Sorry I said each one separately because I did it with various changes, each one may be varied on each time on changing values.
and now the Error is:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
and my error_log:
[Thu Feb 21 02:58:13.318048 2019] [proxy:error] [pid 4170] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (127.0.0.1) failed
[Thu Feb 21 02:58:13.318146 2019] [proxy:error] [pid 4170] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 60s
[Thu Feb 21 02:58:13.318155 2019] [proxy_fcgi:error] [pid 4170] [client 69.689.30.21:64560] AH01079: failed to make connection to backend: 127.0.0.1
PLEASE HELP ME