The input file is not specified in nginx on manjaro linux - laravel

I use manjaro. I'm trying to deploy my site locally on the laravel framework. I use nginx server. When I go to the site page, I get the error: No input file specified. I think there is an error in the configuration files, but I don't know how to find it and fix it. Below are my configuration files
Nginx config file:
user mrgoodcat;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
#include /etc/nginx/sites-enabled/*;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
types_hash_max_size 4096;
server {
listen 80;
server_name localhost;
root /home/mrgoodcat/PhpstormProjects;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/mrgoodcat/PhpstormProjects;
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
root /usr/share/nginx/html;
include fastcgi.conf;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/mrgoodcat/PhpstormProjects;
}
}
## #note Load configs
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
}
Site config file:
server {
listen 80;
listen [::]:80;
server_name project-a;
root /home/mrgoodcat/PhpstormProjects/project-a/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}

Related

Why Laravel9 + vue3 app production build keeps adding /build/ path in my URL?

This is my nginx config:
server {
listen 80;
listen [::]:80;
server_name test.com;
root /var/www/test.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
#include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
#fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
eveything is working except my url keeps displaying like this:
http://test.com/build` instead of `http://test.com/
http://test.com/build/profile/2` instead of `http://test.com/profile/2
is there a problem in my configuration?
and the worst part is when I try to refresh browser the page it returns 404.
Thank you!

Laravel Docker - The POST method is not supported for this route. Supported methods: GET, HEAD

I have a codecanyon project, and it can be installed in shared hosting without any error. Works like charm. However I was trying to install the same using docker-compose. I am getting error as "The POST method is not supported"
People have suggested for laravel codefix for such error, however in my case code works in Sharedhosting. I think some issue with the nginx config not the laravel code.
I am not expert, hoping someone can point me out where to dig.
Laravel error stack
Docker Console
https://flareapp.io/share/x7K9Y2Lm#F31
I have also attached related code
default.conf
server {
listen 80;
server_name starhardware.com.my;
root /var/www/app;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
nginx.conf
user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
Thank you.
Well.. Initially I was only looking for error at Laravel side. I did more investigation related to nginx and came to this thread.
Laravel routes not found after nginx install
I followed it and it worked. my revised default.conf as below:
server {
listen 443;
server_name starhardware.com.my;
root /var/www/app;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}

Nginx 404 Not Found Error. How can I fix it?

I'm using Laravel 8 for my project.
Php: 7.4
Using AWS Nginx Server
My Application's Homepage is fine. The homepage is working well. But, when I'm clicking a link then I'm getting a 404 Not Found error from Nginx.
Here is my server config in nginx.conf
server {
listen 80;
listen [::]:80;
server_name something.com;
root /srv/something.com;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
What to do? What to change?
How to fix this error?

Public folder is forbidden in nginx

I successfully deploy my Laravel app to in digital ocean, but my CSS & JS file are 403 (Forbidden), inside my console it show me error of net::ERR_ABORTED 403 (Forbidden)
how can I give permission to my CSS &JS in my nginx on digital ocean?, any help
nginx config
// nginx configuration
server {
listen 80;
server_name DOMAIN_NAME_OR_IP_ADDRESS;
root /var/www/name_of_repo/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.(?!well-known).* {
deny all;
}
}

How to configure Orchid control panel, and nginx if needed, so that Orchid loads the javascript and css files?

How to configure Orchid control panel, and nginx if needed, so that Orchid loads the javascript and css files?
Under ubuntu 18.04 running vesta control panel, Orchid does not load the javascript and css content at somesite.com/dashboard.
Since nginx properly loads the css and javascript at the somesite.com/ it appears that the nginx conf is not causing it.
Any help would be greatly appreciated.
/home/user/conf/web/somesite.com.nginx.conf:
server {
listen some-server-ip:443 ssl;
server_name somedomain.com www.somedomain.com;
root /home/user/web/somedomain.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php index.html index.htm;
access_log /var/log/nginx/domains/somedomain.com.log combined;
access_log /var/log/nginx/domains/somedomain.com.bytes bytes;
error_log /var/log/nginx/domains/somedomain.com.error.log error;
ssl_certificate /home/user/conf/web/ssl.somedomain.com.pem;
ssl_certificate_key /home/user/conf/web/ssl.somedomain.com.key;
location / {
# added the following line to allow nginx to recognize laravel dynamically created directories
try_files $uri $uri/ /index.php?$query_string;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/user/web/somedomain.com/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/user/web/somedomain.com/stats/;
include /home/user/conf/web/somedomain.com.auth*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/user/conf/web/snginx.somedomain.com.conf*;
}
Orchid relies entirely on Laravel settings
server {
listen 80;
server_name example.com;
root /example.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Pay attention to the documentation.
Solution: orchid.software/en/docs/installation > Publishing resources: php artisan orchid:link.

Resources