Golang app on Heroku htaccess basic auth - .htaccess

Is possible use htaccess on golang application running in heroku??
I had read this link but the solution doesn't work for me (also, the command htpasswd is not recognized in the heroku bash, but I made the htpasswd file usin this tool).
Thank you.

A Go web application is a server so no need to use Apache httpd server, especially on Heroku that has crystal clear deployment instructions for Go :
https://devcenter.heroku.com/categories/go
Follow these instruction closely and you'll find out there is no need for Apache.
htaccess and htpasswd are related to Apache httpd server, they are Apache configuration files.
Finally, Go standard library gives you all the tools you need to implement basic auth yourself :
https://golang.org/pkg/net/http/#Request.BasicAuth

Related

Serving Node.js files from a LXC Turnkey container -Apache configuration needed?

I hope that I will not waste everyone's time, nor embarrass myself, but please hear/read my problem. I am new to this, so please bear with me.
Someone at work wrote a crude code in Node.js and I can see the .html files by having localhost: 8080 as the URL in the browser, while having the VisualStudio starting the npm with npm start command. Am I explaining this clear enough?
The webpages are displayed and all, but now comes the hurdle.
How can i have those pages served from a a Linux server?
If by analogy, I put some.html page inside the /var/www/ in a Apache server, pointing to the server's IP/somepage.html i can visualise it, what needs to be set up on a similar Node.js server?
Where do I have to put those files, inside what directory and what configuration is needed?
I thought to create a small LXC container and have those files and services saved as a template, but first I need to set this up correctly. Can Apache serve those files, do I have to make another configuration first?
I have those files served from a Windows machine from local host, and put the same files in a /node ,/opt/ www directory in a Linux machine, but no dice.

How to block external access to website?

I'm currently building a web server on Centos7 and I'm using Virtualmin and Nginx instead of Apache.I have established the connections and I'm now going to install some modules and later install Wordpress. But how can I set the site to 'offline mode' or make it only accessible internally so that google and others can't reach the site?
Try to generate .htpasswd file

Enabling basic http authentication in IIS on Elastic Beanstalk?

For a demo site on Elastic Beanstalk, I'd like to enable basic authentication in IIS (not in the app, but instead have IIS handle it). I can't find how to configure IIS to do this - you don't seem to have much access to IIS configuration itself. Any tips on that appreciated, or if I'm missing the boat here.
thanks!
You need to use ebextensions to customize the server.
Create a yaml init.config file inside a folder called .ebextensions in your web application root. Set the contents as follows:
container_commands:
00-iis-features:
command: dism /online /enable-feature /featurename:IIS-BasicAuthentication
Read more about ebextensions here
Also, see my answer here https://stackoverflow.com/a/42336644/1165140 on how to modify root IIS config.
Hope this sorts you out.

How do I profile a Codeigniter Web App with XDebug?

I'm running XDebug on Linux CentOS. I want to profile pages on a web app built with CodeIgniter, served by Apache.
XDebug is enabled in php.ini with the following settings:
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/xdebug
Everything works fine when I trigger php scripts from the command line, and XDebug profile logs are written to /tmp/xdebug, as expected. When I load a url from the web app through the browser, XDebug does not create any profile log files.
Has anyone gotten XDebug to work with Codeigniter? From what I can tell, I should not have to trigger XDebug profiling via GET in the url because profiler_enable is turned on for all php scripts, although I've tried this and it doesn't seem to work either.
Apache needed to have write permissions on the /tmp/xdebug folder.
sudo chown -R apache:apache /tmp/xdebug
XDebug can profile Codeigniter page loads from a browser now.
Thanks #J. Bruni.
It seems to me that the issue is not related to CodeIgniter... It seems you may have multiple php.ini files...
In my Ubuntu installation, I have several sub-directories inside /etc/php5 directory: cgi, cli, fpm, etc. Each one of these has a php.ini file inside it, which is specific to a single "mode".
In other words: PHP may have several different php.ini files... one for CLI (command-line), other for CGI, and so on...
Maybe the xdebug configuration lines you pasted above are not in the php.ini file used when you access PHP scripts from the browser. Maybe you added these lines to /etc/php5/cli/php.ini instead of /etc/php5/cgi/php.ini (or another... in my setup, it is /etc/php5/fpm/php.ini, because I use php-fpm)

Node.JS webserver with CGI support (Open Source)

Is there an open source Node.JS webserver available yet that has CGI support?
There is a node-cgi module (found through npm registry) which looks to be actively maintained.
If you are looking for a CGI module to run node.js under webservers like Apache or IIS then cgi-node will allow you to do just that.
Apache example: you can add a .htaccess file within your web folder to point all *.jscirpt files to be executed using Node.js through the cgi-node module. Something like this:
Action cgi-node /cgi-bin/cgi-node.js
AddHandler cgi-node .jscript
Also including the cgi-node.js script found on the cgi-node.org website within the cgi-bin folder.
CGI-Node allows Node.js to behaves exactly like PHP when running under a webserver.
Documentations and tutorials available on the site: cgi-node.org

Resources