I just start using Bitnami Wordpress for Apache and I am having trouble implementing Password Autofill for iOS: https://developer.apple.com/documentation/xcode/supporting-associated-domains
In a nutshell, a file called apple-app-site-association should be available from a .well-known dir on a domain:
https://<fully qualified domain>/.well-known/apple-app-site-association
served with application/json
The thing is, that almost every tutorial I come across has been outdated. Take Config apple-app-site-association file with WordPress for example. They are talking about paths like /etc/apache2/sites-available/default-ssl, but I don't have a /etc/apache dir.
I am connected to the server over SFTP. I see that my root dir is /home/bitname/. Inside that, I see a stack dir which contains the wordpress dir. I upload a file to this dir and I can download it instantly from my domain. But when I create a new .well-known dir and put the file inside there, I can not reach this following domain:
https://<fully qualified domain>/.well-known/apple-app-site-association
I restarted Apache like this:
sudo /opt/bitnami/ctlscript.sh restart apache
And it doesn't work. Any suggestions?
Related
I have been handed a Ruby Project that creates a document and serves it to the user, when I try to access the file on a local environment it it is delivered correctly, (this is the code that does so).
filepath = Rails.root.join("public",#records.document.url)
send_file (filepath)
So I know the file is constructed correctly and sending it to the user using send_file works at least in a local environment.
But when it's deployed on the production server (running Amazon EC2, ubuntu, deployed with dokku) I get a 500 Internal server error:
ActionController::MissingFile (Cannot read file *path of the file*)
Few things I'm noticing: doing a find / -iname "*filename*" tells me the file is stored in var/lib/docker/overlay2/*container_name*/merged/app/public/filename and var/lib/docker/overlay2/*container_name*/diff/app/public/filename but the result of joining Rails.root with the filename is app/public/filename, do I need to pass send_file the whole filepath?
I googled for a couple hours and it seems nginx has no access to the public folder because it's running in the host machine while the app is inside a container? How would I know if that is the case and if so, how should I serve the file?
The person who originally wrote the code told me to use OpenURI.open_uri() but googling it doesn't seem to turn up anything applicable to the situation.
Nothing you're doing here actually makes sense - its sounds like you're just following a bunch of misinformation down a bunch of rabbit holes.
The way this is supposed to work is that the files in /public - not /app/public are served directly by the HTTP server (NGinX or Apache) in production and your Rails application in development (so you don't have to configure a local HTTP server). The /app directory is for your application code and uncompiled assets. Do not serve files from there - ever.
The /public directory is used for your compiled assets and stuff like robots.txt, the default error pages and various icons. Serving the files directly by your HTTP server is far more efficient then serving them through your Rails application. You can do a litmus test to see if serving static assets are working by sending curl -v YOUR_URL/robots.txt.
If this isn't working in production you need to check your NGinX configuration. There is no shortage of guides on how to serve static files with NGinX and Docker.
Serving files with a Rails controller and send_data / send_file should only be done when its actually needed:
The file is not a static file or something that can be compiled at deploy time.
You need to provide access control to the files with your application.
Your proxying files from another source.
I successfully deployed my Rails application fireworks_app with Dokku in a Ubuntu 18.04 LTS machine, and now I would like to add a logrotate file for my Rails logs. What is the path of my application and thus of my log files? There is a /home/dokku/fireworks_app folder but this folder contains only the following items:
$ ls
CONTAINER.web.1 DOCKER_OPTIONS_RUN HEAD URLS cache hooks maintenance objects
DOCKER_OPTIONS_BUILD DOKKU_SCALE IP.web.1 VHOST config info nginx.conf refs
DOCKER_OPTIONS_DEPLOY ENV PORT.web.1 branches description letsencrypt nginx.conf.d
I suppose somewhere in the system there is a folder containing my application with the known Rails file structure, but I cannot find it.
Inside your rails application you can do something like Rails.root to get the path to the root directory of your project.
For instance, if the log files are in fireworks_app/lib/log/ you could do Rails.root.join('lib','log','log_file.log') to get the path to that file.
I have a simple ember.js app, and I would like to support Universal Linking to my native iOS app. I have successfully done this with a simple apache server or node server, but I am new to ember.js.
How would I configure my ember.js app so that it serves a raw json file from the root directory of my site, like:
http://example.com/apple-app-site-association
The Content-Type of this file needs to be set to application/json as well.
Is there an easy way to do this in ember.js?
I tried just putting the file in my dist folder after building, but that didn't work.
The answer is so simple I'm tempted to just delete the question.
All ember serve does is serve the contents of the dist folder.
If you need a differently-configured server, just take the contents of the dist folder after running ember build and serve it from your own server. Then you can configure it to serve the apple-app-site-association file as you need.
Hello I dont know what is the best way to redirect all on public. I'm doing on server, not on local.
On local I can make VHost and editd host file but when i put with FTP on server www.example.com I cant make vhost.
How now can do redirection on public ?
On www.example.com he list me directory structure :
config/
data/
init_autoloader.php
module/
public/
vendor/
I really don't know apache .htaccess any example how to do that redirection.
Thanks.
You don’t need to do it yourself. It’s done by your web hosting provider. It can point to the public_html folder instead of public but that doesn’t matter. So you can just add your other folders as siblings to the public_html and it’s done.
The redirection part is taken care by the .htaccess files put under the root folder of host, below is my answer to one of this similar question, the link that shows how to host a ZF2 app in a shared hosting environment
zf2 installation on shared hosting server
I have a dedicated CentOS server. I manage all my users, apps, and virtual hosts manually. I'm using Apache 2.2.3 and Passenger 3.0.7 to serve my apps. I have a typical httpd.conf file in /etc/httpd/conf/ that includes all *.conf files in my /etc/httpd/conf/vhosts/ directory. Normally for each app I create a new sample-domain.com.conf file in the vhosts directory.
However, I have a particular app that needs frequent apache configuration changes, and I'd like it to be more a part of my app and its version control. So I've moved my apache configuration file into the apps config directory. I added a script to my Capistrano deploy.rb that sets the permissions on the apache conf file in the app to 755. I added an include line in my vhosts that includes the symlinked current version of the apache conf file from the app.
Which brings me to my simple question: is this safe or a bad idea?
For frequent config changes in Apache, consider using a .htaccess file instead. Changing .conf files requires bouncing/hupping the server, and if a .conf file has an error, that'll kill the whole server and take down all sites. A .htaccess error will take down just the one site/directory where the file is.