404 not found for foundation source files - laravel

Running on nginx+laravel+foundation(simple css copy put into folders inside public directory) with a simple route and view and get 404 error for every source foundation file.
it looks like this for every file:
Remote Address:127.0.0.1:3000
Request URL:http://127.0.0.1:3000/css/normalize.css
Request Method:GET
Status Code:404 Not Found
tried different path notations(full, relative, via assets method or without it): same result.
can't find something informative on the issue within nginx logs.
and Uncaught ReferenceError: $ is not definedregister:65 (anonymous function) for these lines:
<script src="http://127.0.0.1:3000/js/vendor/jquery.js"></script>
<script src="http://127.0.0.1:3000/js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
should be something simple, but just can't get it myself.

just fixed it: the problem was with my rewrites.
deleted this line from nginx.conf in the main server block:
rewrite ^.*$ /index.php last;
and got all the source files with no errors.

Related

Laravel 7 - Unaccessible when trying to open site on production

i've deploied my laravel site on my server.
but i got a problem.
First:
my files was in the public_html folder.
I got the 403 forbidden error.
Then:
i tried to move them outside the public_html folder and only put the laravel's public folder contents onto that.
it only show "Nginx is functioning normally".
I get the next message:
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
and the next log: [error] 8949#0: *2449542 access forbidden by rule, client: 13.90.224.16, server: marchethiaroye.com, request: "GET /.env HTTP/1.1", host: "www.marchethiaroye.com"
error log
Please help! It's my first deploiment.
NB: the site is working on local
file configs message i got
Let's assume your laravel project name is 'test'.
And you put 'test' on public_html.
Try open http://IP_ADDR/test/public

Laravel-Project deployment via FTP

I want to deploy my Laravel-Project but it always shows me this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at admin to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
My Server Structure is like that:
/
/protected --> All Files and Folders within the project (+ /node_modules & /vendor) except the /public-folder
/public_html --> all Files and Folders within the /public-folder
I already changed the permissions for the /storage-folder and I already changed the paths in the /index.php to
require __DIR__.'/../protected/vendor/autoload.php';
and
$app = require_once __DIR__.'/../protected/bootstrap/app.php';
Any ideas?
place all the files from your localhost (htdocs) to public_html. Also make sure there is no any redirection in your domain-redirection on your hosting server.
The main reason of the internal server error is that your domain is not pointing the directory which you define.
In my case, the index.php file is
require DIR.'/../vendor/autoload.php';
$app = require_once DIR.'/../bootstrap/app.php';
Do all the changes one by one, this will work in your case hopefully. I have mentioned the reference link below please check
https://laracasts.com/discuss/channels/laravel/laravel-deploying-to-server-using-ftp

My static files are not rending correctly

In my html page I am referencing static assets like:
<script src="/static/assets/js/bundle.js"></script>
and
<link rel="stylesheet" href="/static/assets/css/style.css">
These files are stored in:
/assets/js/bundle.js
/assets/css/style.css
Currently my route looks like this:
app.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/assets"))))
Currently it is not working and returning a 404 not found error when I look at chrome console.
What am I doing wrong here?
The problem is with your call to http.Dir("/assets") in this line:
app.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/assets"))))
http.Dir takes the path to the folder either in absolute form or relative to where the go executable is. Using "/assets" tells it that the absolute path to the assets folder is on the root of the file system, where in reality I'm guessing the assets folder is in something like /home/YOUR_USER_FOLDER/code/this_project/assets.
Just change the code to use the absolute path:
app.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/home/YOUR_USER_FOLDER/code/this_project/assets"))))
If the assets folder is in the same location as the go executable, you can just use "assets" as the file path, but I will recommend using the absolute path to avoid any confusion.

Code Igniter - http://localhost:8081/ci/assets/js/jquery.js%22 403 (Forbidden)

I searched other posts and tried creating a helper function to create an asset_url as explained in this post, but no luck. I previously had to set the base site in my config.php file as such: $config['base_url'] = 'http://localhost:8081/ci';.
The code in my application\views\layouts\main.php file, just before the closing body tag is:
<script src=<?php echo base_url();?>assets/js/jquery.js"></script>
<script src=<?php echo base_url();?>assets/js/bootstrap.min.js"></script>
I'm running on XAMPP. I had to change the port number to 8081 after installing visual stuido and it conflicted with the default port 80. So my exact queston is what else can I do to resolve the 403 forbidden access in code igniter so that JS and Jquery scripts will work?

smarty not working in subfolder

I am using smarty 3 .its not working in subfolder.
Folder Structure
WWW
->admin
->cache
->configs
->libs
->plugins
->templates
->templates_c
index.php
In index.php [Root Folder] it working correctly.
But in admin/index.php it not working i am getting error.
here is my code
require_once('../libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');
Error :
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.tpl'' in D:\wamp\www\libs\sysplugins\smarty_internal_templatebase.php on line 127
After reading some stackoverflow answer i added $smarty->template_dir = "/templates"; but still i am getting the same error.
Please help me thank you
The content of $smarty->template_dir is relative to the actual directory. (if it is a relative directory.)
It means if you call a admin/index.php then it searches the templates in the admin/templates directory by default. (without adding anything.)
So in the admin directory you should use:
$smarty->template_dir = "../templates";
or an absolute directory.
Otherwise I think you should read this page:
http://www.smarty.net/docs/en/variable.template.dir.tpl
Especially this sections:
It is not recommended to put this directory under the web server document root.

Resources