How to create opt/bitnami/apps/myapp/conf/httpd-prefix.conf and include /opt/bitnami/apps/myapp/conf/httpd-app.conf - google-compute-engine

Please guys help out, am using google compute engine for the first time and using bitnami. I have successfully spin up a server, and connected with ssh but am stock here https://docs.bitnami.com/virtual-machine/components/nodejs/#how-to-create-a-custom-nodejs-application
Can anyone help me explain how:
1.- Create and edit the /opt/bitnami/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:
Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
2.- Create and edit the /opt/bitnami/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application's requirements.
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
NOTE: 3000 is the default port for the Express server. If you have
customized your application to use a different port, change it here as
well.
3.- Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf, as shown below:
Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf"

According to the Bitnami guide shared by you, you should follow the following steps (I added more detailed information):
1.- Create directories
For that, you should run the following commands:
sudo mkdir -p /opt/bitnami/apps/myapp
sudo mkdir /opt/bitnami/apps/myapp/conf
sudo mkdir /opt/bitnami/apps/myapp/htdocs
2.- Create two files
For that, you can run the following commands:
touch /opt/bitnami/apps/myapp/conf/httpd-prefix.conf
touch /opt/bitnami/apps/myapp/conf/httpd-app.conf
3.- Add content to the first file
You can edit the file using any text editor, for example nano
nano /opt/bitnami/apps/myapp/conf/httpd-prefix.conf
The above command opens the text editor, you should copy/paste or write the following line:
Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
Close the editor using Ctrl+X(you will be prompted to save your file if you have not)
4.- Add content to the second file
You can edit the file using any text editor, for example nano
nano /opt/bitnami/apps/myapp/conf/httpd-app.conf
The above command opens the text editor, you should copy/paste or write the following line:
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
Close the editor using Ctrl+X(you will be prompted to save your file if you have not)
5.- Edit Apache config file
Once you have created the files and directories above, add the following line to the end of the main Apache configuration file. Open the file (again using nano):
nano /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
The above command opens the text editor, you should copy/paste or write the following line:
Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf"
Close the editor using Ctrl+X(you will be prompted to save your file if you have not)
6.- Restart apache
For that execute
sudo /opt/bitnami/ctlscript.sh restart apache
7.- Start the Express server
cd /opt/bitnami/apps/myapp/htdocs
./bin/www
Alternatively, use the following command to start the server and keep it running even after your server session ends. Replace FILE with the correct filename for your application.
forever start FILE.js

Related

Using command line to open, edit and save content in file

During the work, there are a lot of partners in the project, and sometimes I need to switch among different partners a lot, and every time the process:
change the partner name in .env file manually
run docker-compose down in the terminal
run docker-compose up -d in the terminal
run gulp dev --partner <partner name> in the terminal
So my question is :
Would it possible to use one line of command to complete the entire above process (such as in the package.json, "docker": "docker-compose down && docker-compose up -d", then npm run docker means running docker down and up)
Basically the main point should be :
Would it be possible to use command line to open, edit and save a file? (I know I could use command line to open vi, and then to edit inside vi, but here is not the case)
There's certainly methods of text editing from the command line (see sed/awk etc.) My solution to this, would be to have multiple .env files:
e.g. .env.alice; .env.bob; .env.charlie
Then as part of my script I would symbolically link the one I wanted:
ln -sf .env.alice .env
The rest as you described.

CGI Script displayed as Plain Text in Apache2 (localhost)

I currently have to do a web server in Apache2 that consists on a Login/Register web, and I have to call a CGI Script to validate the input data from the user. Well, when I call the script with the submit button, the CGI Script appears as Plain Text, and I don't know what else to do to fix it.
I have tried uncommenting CGI Modules in /etc/apache2/httpd.conf, setting a default directory for CGI Scripts, uncommenting the AddHandler for CGI and changing Options values in my localhost directory and in the CGI directory adding ExecCGI in them all. But it still does not work, it just appears as plain text.
P.S.: I followed this tutorial (http://httpd.apache.org/docs/2.2/howto/cgi.html) and also looked for the solution here in StackOverflow, but I got nothing working for me.
Edit: Also thank you for helping if you do :)
The problem was the directory configuration, so I kept the default http.config file, that has a preset ScriptAlias for the /cgi-bin/ directory to the following directory:
/Library/WebServer/CGI-Executables
Then I enabled the CGI Module by uncommenting the line (removing the '#' before the line) in the httpd.conf file from apache2:
LoadModule cgi_module libexec/apache2/mod_cgi.so
Finally I saved the file, and then I restarted the Apache2 server using the command:
sudo /usr/sbin/apachectl restart
Then I just pasted the .cgi script in the CGI-Executables directory, setting the permissions of the file as chmod a+x.
To run the script now you just have to access
localhost/cgi-bin/script.cgi
Thank you for the help anyways!

PHP Mysql laravel 5.4 terminal issue

i am new to laravel i just figured out how to install composer laravel etc etc on my local machine MAMP on windows , Now i am confuse with the command on terminal which is
C:\project>mysql -uroot -proot
'mysql' is not recognized as an internal or external command,
operable program or batch file.
How can i fix this ?
setting Environment will solve the issue
Go to Control Panel -> System -> Advanced
Click - Environment Variables
Go to- System Variables find PATH and click on it.
add the path to your mysql\bin folder to the end paths. (ex: E:\xampp\mysql\bin) and add ; end of the line
Close all the command prompts you opens.
Re open and try it.
Setting the PATH to point to the MYSQL bin folder is normally the first thought, but I find that dangerous as things get left lying around when you change software.
I normally create a little batch file in the projects folder or in a folder that it already on your PATH, like this
mysqlpath.cmd
echo off
PATH=C:\mamp\path\to\the\mysql\bin;%PATH%
mysql -v
The mysql -v will output the mysql version number but it is a handy way of knowing that the correct folder has been added to the PATH. This adds the folder to the PATH but only for the life of the command window.
Then just run this from any command window when you want to use MYSQL from the command line
> phppath
You may also like to create one for PHP as well
phppath.cmd
echo off
PATH=C:\mamp\path\to\the\php\;%PATH%
php -v

Location of MySQL configuration file (ie: my.cnf) not specified

Location of MySQL configuration file (ie: my.cnf) not specified
How can I fixed this thing?
I been trying to reinstall mysqlserver 5.5 / 5.7 and workbench countless of time. But I still not able to fix this issue.
I solved this problem. Step one: click here
Step two: and then click here to choose your path
Step three: my path is C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
If you already know where your configuration file is located, but just don't know how to specify it in mySQLWorkbench, you can skip steps 1-3 and just follow step 4 in these instructions.
Step 1: Make sure which mysql is running (just in case you have multiple installations on your system) and how:
$ ps aux | grep mysql
may result in something like:
_mysql 120 0,0 3,4 5122736 565108 ?? Ss Fr01pm 61:05.93 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid
If, in this output, you see that mysqld has been started with the --defaults-file option, that option specifies the configuration file used by msql. If so, you have found the configuration file and can skip to step 4.
If not, check if this returns the same binary location as above command:
$ which mysqld
If not, then make sure you use the full path for mysqld from the first output in the following step.
Step 2: Ask mySQL which configuration files it is using:
$ mysqld --verbose --help | grep -A 1 "Default options"
should output something like:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
Step 3: Check the given locations in that order. The first finding should be your mySQL configuration file.
Step 4: In mySQLWorkbench go to Database > Manage Connections, then select the connection, select tab System Profile, and enter the path and file name in Configuration File.
This should be it.
And if still nothing happens, you may have used the installer Package. If you have, then you must select the Installation Type from the drop-down to reflect that before you locate the configuration file.
Here's a screenshot that follows from the above screenshots
Also, there may not be a config file and you can create one here, then get out of the Options File, go back in and you will see all the options.
I changed my setting from Custom to MacOSx (MySQL Package) under: Database → Manage Connections → MySQL Connections → Select DB Connection → System Profile → Installation Type → (default setting) MySQL Package.
Change from custom to default setting:
Reconnect by testing connection:
For maria-db users
back up the original /etc/mysql/my.cnf
copy and rename /etc/mysql/mariadb.conf.d/50-server.cnf to /etc/mysql/my.cnf.
This would fix the problem.
Remember to revert changes after finish.
For those with Mac OS Catalina:
I did not have a my.cnf file. I went to /usr/local/mysql/
and created a directory named etc, which I did not have either.
Then, inside that directory, I created the file (my.cnf).
This is the link that helped me How to fix --secure-file-priv option error
for mysql 5.7 users and MAMP: just create /etc/my.cnf
macOS 13 and MySQL 8 current:
Open MySQL Workbench on your Mac. Connect into your localhost instance of MySQL.
Click the little wrench icon next to INSTANCE on the left pane above Startup / Shutdown.
Select macOS as System Type, macOS as Installation Type, and the rest will default into place. Copy the location it gives you for the my.cnf file.
Click Close
Now click Options File on the left. It will notice that you don't have a file and will show you default values.
Click the Apply... in the bottom right corner.
It will then ask you for a password of your current logged in user of your Mac to create and save the my.cnf file.
Now in the Finder use the keyboard combo of Command-Shift-G and copy in your location we copied early (i.e. /etc/my.cnf)

How to install wordpress with MariaDB?

I am trying to install wordpress on my nginx + mariadb
First step of: pointing my url to
http://localhost/wordpress/
is throwing following error:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
I hope many other people are using wordpress with mariadb.
[EDIT]
Using WNMP for bundle installation of ( Nginx + MariaDB + PHP )
Maybe this helps you, its for Windows 7. Here are the steps
Get the files
Download only the compressed files which do not require installation to use the programs
get the Xeoncross’ WNMP https://github.com/Xeoncross/wnmp
get memcached http://code.jellycan.com/memcached/
get MySQL http://dev.mysql.com/downloads/
get nginx http://nginx.org/en/download.html
get PHP http://windows.php.net/download/
get phpMyAdmin http://www.phpmyadmin.net/home_page/downloads.php
get wordpress http://www.wordpress.org/
Place the files
extract the content of WNMP to d:wemp
extract the memcached.exe to d:wempmemcached
extract the contents of MySQL to d:wempMySQL
extract the contents of nginx to d:wempnginx
extract the content of PHP to d:wempPHP
extract the content of phpMyAmdin to d:wempwwwphpMyAdmin
extract the content of wordpress to d:wempwwwwordpress
Configure
for MySQL, rename d:wempMySQLmy-small.ini to my.ini
for NginX, copy d:wempexample.nginx.conf to d:wempnginxconf, rename nginx.conf to nginx.conf.bak and rename example.nginx.conf to nginx.conf
for PHP, rename d:wempPHPphp.ini - development to php.ini
open the php.ini file in a text editor, remove the ; preceeding extension_dir = "ext"
remove the ; preceeding cgi.fix_pathinfo = 1
remove the ; preceeding extension=php_mbstring.dll
remove the ; preceeding extension=php_mysql.dll, save the file
Run
run d:wempstart_server.bat to start running, a few command prompt windows will pop up and disappear
Confirm they are running
open task manager by pressing Ctrl + Shift + Esc
check php-cgi.exe, memcached.exe, mysqld.exe, nginx.exe are running
run the following command in command prompt to change the root password of MySQL d:wempmysqlbinmysqladmin -u root password hereIsYourPassword
If face problem starting mysqld.exe than look the error in d:wempmysqldataerr.log
Test the server and install WordPress
start a browser (make sure there is no proxy)
visit http://localhost/
see the WNMP success page
visit http://localhost/phpMyAdmin/
log in with username root, password hereIsYourPassword!
create a database with the name wordpress
visit http://localhost/wordpress/
start the famous 5 mins installation of wordpress
mariadb is 100% compatible with the mysql interface in php
i think you're missing the module for php
depending on the distribution you're using i'd say do a
sudo apt-get install php5-mysqlnd
you can make sure the mysql mod is enabled by doing a phpinfo();
when running php5-fpm with nginx make sure the module is enabled at the right place
/etc/php5/fpm/