NuxtJs Build SPA on Nginx server [closed] - vue.js

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
i want to deploy my Single Page Application on my Nginx server
so i run
npm run build
and i uploaded the dist folder to my server, and it works fine with the static pages, but if on the dynamic pages that have a dynamic url i got the below error
ERROR 404 - PAGE NOT FOUND
can you please help me with this.

Your webserver is not aware of the routing inside your Vue application, so you'll need to have Nginx point all requests to the application to the index.html and after that Vue routing will take over. The documentation can be found here.
The required configuration snippet copied from there is the following:
location / {
try_files $uri $uri/ /index.html;
}

Related

Vue router to serve a json file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I need to render/serve a json file using vue router for https://mysite/apple-app-site-association. I don't use webpack and the app is hosted as azure static web app. I want to return content-type as application/json as well. I'm using Vue 2.6. How do I do this?
It will depend a little on how you are serving your web pages on Azure but I did the following on AWS, which has virtually nothing to do with Vue.
Created a new folder in my public folder
Added the json file to the new folder
Deployed my app (which creates the folder on the AWS host and puts the JSON file in it)
Configured my host to override/bypass my Vue SPA and serve the JSON file for a particular path (in my case AWS cloudfront).
I could have manually added the JSON folder and file to my cloud host and configured it to serve the JSON but I wanted an automatic deployment. Sorry I can't help on Azure but I hope there are similar concepts as cloudfront on AWS.

How to add a backend to the webpack template? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm new to Vue.js and Webpack. I try to use the webpack template by using vue-cli.
After generating a new project I'd like to add a backend.
My question is if it'a a good idea to add the backend(express server) to the same project?
Or should I create a new project for this?
If you look through the issues of the template you will find a lot of answers. Especially Issue #456 is discussing this topic by using a proxy. The proxy will just mirror the api to run through the local enviroment. So you do not have any CORS issues.
Another source is in the documentation folder: Backend. It basically suggest to use a proxy table which will mirror your local calls to some kind of backend. I like to run two different types of projects (one asp.net core web api and this template).
Edit your config/index.js to something like:
// config/index.js
module.exports = {
// ...
dev: {
proxyTable: {
// proxy all requests starting with /api to jsonplaceholder
'/api': {
target: 'http://localhost:5431',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
}
}
Requests to /api/posts/1 will be mirrored to http://localhost:5431/posts/1.
I have the same question and found this interesting project: https://github.com/danmademe/express-vue. Seems like a possible solution and received a decent amount of stars. Disclaimer: I am also new to nodejs and can tell you more about it. I will give it a shot, particular because it has two example projects.
Here is the background blog post.

Server fault issue [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am trying to link to a specific page within a PDF.
For desktop the URL works with:
https://www.examsolutions.net/papers/edexcel/gcse/nov17/paper2/paper2QUE.pdf#page=3
It takes you to page three, but does not work on mobile. However if I use jQuery
if ($(window).width() < 600) {
$("a").each(function(){
var newUrl = $(this).attr('href').replace('page=', 'page');
$(this).attr('href', newUrl);
});
}
The URL is changed to:
https://www.examsolutions.net/papers/edexcel/gcse/nov17/paper2/paper2QUE.pdf#page3
The removeal of the '=' works, but only on iOS. Is there a solution for Android or is it not possible due to Adobe PDF licenseing etc?
Option A is fine - do that.
It depends what the set up is on your new hosting...
If you have cPanel you can add the old domain as a parked domain - takes 30 seconds to set up - then just point your name servers/DNS the new hosting.
Alternatively you can set up the old site on your new hosting, then do a 301 redirect in the .htaccess file pointing it to your new domain.
http://css-tricks.com/snippets/htaccess/301-redirects/
Thanks for all the helpful guidance, I took it all on board and thought I would post back what I actuall did incase someone else needs a breakdown. To be clear, my hosting is a VPS on a LAMP stack running Ubuntu.
Repointed the a-record of the old site to the new one.
Created a config file in the sites-available folder of apache2
Pointed that config file to where I wanted the hosted folder to be,
in my case home/www/vhosts/
Created a folder in the above in the name of the old website
Added the .htaccess file in that folder with the 301 redirect in it.
Made the website active my using the a2ensite command
Restarted apache

index.php appending to url [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a magento site which has index.php appended to the url you click on. I googled a lot to find the solution and i did what i could find.To clear my my doubts i uploaded htaccess file fresh copy from magento copy and made the url rewrite in configuation>system>web to yes and clear the cache too but still it put index.php in url.I have also double checked secure and unsecure link to see if it contain any index.php which it doesn't
I can do all what i can to do research and applied it but no change. What can i do or what can be wrong?
The steps you describe should be right:
System > Configuration > Web > Use Web Server Rewrites set to yes (also check the store view level value, because the scope for this is not global)
.htaccess present in document root
clear Magento cache
Additional things to check:
System > Configuration > Web > (Un)secure base url
does your Apache take into consideration .htaccess (AllowOverride)
how did you clear the cache
the scope for your settings System > Configuration > Web > Use Web Server Rewrites

wordpress permalinks 404 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i've read wordpress and the post on here for fixing this and i'm stuck.
i just setup a stock apache2 server with wordpress. my default link for posts works however other options don't.
i've deleted .htaccess and let wordpress regen an not working. by the way i even chmod 666 777 660 nothing works.
The only thing in my .htaccess is two lines begin and end wordpress. i added override above all and still nothing.
I looked in apached2.conf but see no modules for loading overrides.
is this a server issue or wordpress permission or something. if I can narrow it to one side or the other.
also http.conf is empty if that helps.
I got it. had to chown www-data my /var/www
Did you enable mod_rewrite in http.conf?
Earlier SO question: How to enable mod_rewrite for Apache 2.2