I am Using Ubuntu Server and would like to know if it's possible to automatically restart services that go unresponsive. I am operating a standard LAMP stack and occasionally vital services need to be restarted but I want to do it in a programmatic way.
chrisjlee's questions
Are there any advantages of placing a Apache solr server and your lamp/lemp stack on the same EC2 instances?
Or is there really nothing wrong with it all given that it's on an EC2?
Or if there are disadvantages why would you want your apache solr server and lamp/lemp stack seperated into different instances?
The team does plan on scaling this application; so i'm looking to make the best architectural decision based on scalability.
I'm using a particular cloud hosting solution (one which i won't name) and they don't provide ssh access so i'm at a whim on how the database is dumped.
I downloaded the dump which is packed into a tar.gz file. I discover that this file utilizes latin1 encoding. Which i don't get to specify the encoding for the host i'm using because i don't have SSH access or DB access.
I try to import it via command line for my local development environment (mysql -uroot foodb < file.db
) like i usually do with other databases but am having problems.
Is it possible to import a database via command line by specifying which encoding (preferably latin1) before importing it? Or do i have to convert it to UTF8?
Having trouble with a rewrite condition within my htaccess. I need to redirect the request from a subdomain. However, there are three subdomains for each language: en.foo.com, es.foo.com, www.foo.com. If they have a request they must persist the according subdomain.
E.g:
Requested:
fdsfds.foo.com/test
Desired: www.foo.com/test
Currently: www.foo.com
.htaccess file:
# BEGIN .net to .com redirect
RewriteEngine On
RewriteCond %{HTTP_HOST} foo.net$ [NC]
RewriteRule ^(.*)$ http://www.foo.com/$1 [R=301,L]
# END .net to .com redirect
# BEGIN force www on non-www requests
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# END force www on non-www requests
# BEGIN .net to .com redirect (english)
RewriteCond %{HTTP_HOST} ^en\.foo\.net$ [NC]
RewriteRule ^(.*)$ http://en.foo.com/$1 [R=301,L]
# END .net to .com redirect (english)
# BEGIN .net to .com redirect (spanish)
RewriteCond %{HTTP_HOST} ^es\.foo\.net$ [NC]
RewriteRule ^(.*)$ http://es.foo.com/$1 [R=301,L]
# END .net to .com redirect (spanish)
# BEGIN .net to .com redirect (spanish)
RewriteCond %{HTTP_HOST} ^www\.foo\.net$ [NC]
RewriteRule ^(.*)$ http://www.foo.com/$1 [R=301,L]
# END .net to .com redirect (spanish)
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^es\. [NC]
RewriteCond %{HTTP_HOST} !^en\. [NC]
RewriteRule ^ http://www.foo.com/ [L,R=301]
For php there is php -i
. For apache i can debug settings with apachectl -S
.
Is there a way for me to output via command line what the current "sourced" settings for mysql are?
I'm trying to figure out if i correctly set my innodb poolsize.
Having trouble writing this compound rewrite containing the following rules:
Requirements:
- Redirect all http://example.com -> http://www.example.com
- Redirect all https://* -> http://wwws.*
- Enforce all /checkout/* page to use https:
E.G.
http://example.com/checkout/123 -> https://wwws.example.com/checkout/123 or http://example.com/checkout ->https://wwws.example.com/checkout/123
What i have currently done:
I currently have a series of rewrites that rewrites the non-www to the www:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
This is problematic because when a http request for the URI: http://wwws.example.com it redirects that to http://www.wwws.example.com.
How would i achieve a rewrite that would satisfied my requirements?
Normally with a virtual host an ssl is setup with the following directives:
Listen 443
SSLCertificateFile /home/web/certs/domain1.public.crt
SSLCertificateKeyFile /home/web/certs/domain1.private.key
SSLCertificateChainFile /home/web/certs/domain1.intermediate.crt
From: For enabling SSL for a single domain on a server with muliple vhosts, will this configuration work?
What is the difference between SSLCertificateFile
and SSLCertificateChainFile
? The client has purchased a CA key from GoDaddy. It looks like GoDaddy only provides a SSLCertificateFile
(.crt file), and a SSLCertificateKeyFile (.key file) and not at SSLCertificateChainFile
.
Will my ssl still work without a SSLCertificateChainFile
path specified ?
Also, is there a canonical path where these files should be placed?
Currently trying to configure a linode server running on ubuntu 10.04. I utilized a stackscript (Default drupal profile) which seemed to run successfully. The log indicate so as well.
Then ssh'd into the server (as root) to try to configure php.
When i run a which php
, which php5
they both return nothing. A which python
returns something though.
I know where the default path to php but i usually just like to use it as confirmation that php exists.
Do i have to modify some configurations to enable which
to work? Also tab completion doesn't seem to work for when i apt-get install?
Update:
Thanks for the suggestions guys. I've ran a couple commands and no luck either:
[ root@ ~ ]
$ dpkg -l |grep php
[ root@ ~ ]
$ apt-get install php5-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package php5-cli has no installation candidate
Then i tried installing php and php cli:
[ root@ ~ ]
$ sudo apt-get install php5 php5-cli
sudo: unable to resolve host xxxxxxx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package php5 has no installation candidate
This is a common gripe of mine.
I was curious if there is a cheap test to know if mod_rewrite is on?
Is there a directive that i can add to the htaccess file to determine if mod_rewrite is on?
is it possible to conditionally include another file in the htaccess file. When i work locally my apache settings are different from my remote server.
Each time i pull in changes through git to the stage site (which shares the same settings as the live server) i have to apply a patch to my htaccess:
diff --git a/.htaccess b/.htaccess
index 4733ffa..1b39d24 100644
--- a/.htaccess
+++ b/.htaccess
@@ -2,6 +2,15 @@
# Apache/PHP/Drupal settings:
#
+############################################
+## uncomment these lines for CGI mode
+## make sure to specify the correct cgi php binary file name
+## it might be /cgi-bin/php-cgi
+
+ Action php5-cgi /cgi-bin/php5-cgi
+ AddHandler php5-cgi .php
+
+
Is there a way to conditionally include this into my htaccess file. Thus, i could just gitignore this particular include file.
I could do a git hook but i'm not well versed and not interested in investing time at this moment to learn that.
P.S. if you're curious what my patch does is it provides the stage server directives as to where to run php as cgi.
I've been on various different VPS servers and they sometimes automatically setup separate conf files for each virtual host.
I'm trying to achieve the same on my local machine (that runs Ubuntu 11.04 on xampp 1.7.3). How would you go about doing this. Would you edit the http.conf
file? Does apache already does this automatically?
How would one setup separate .conf files for each virtual host in a specified folder (say /opt/lampp/etc/extra/hosts
)?
I'm a novice at cygwin/linux administration so please be patient with my ignorance:
I'm trying to change my .bashrc profile and setup (.gitconfig ) I can't seem to find my home folder.
My hypothesis is that i don't have my home folder because i've remapped my dos $HOME path. Could this be the trick?
Anyways how would one rebuild the home folder ? Uninstall and reinstall cygwin? (i'd like to avoid this if possible).
Thanks a plethora in advance,
Chris