$ sudo a2enmod headers $ sudo service apache2 restartしました。(Ubuntu13.10です。)
http://stackoverflow.com/questions/10185717/internal-server-error-htaccess
最近プチネタばっかりだな。。。
$ sudo a2enmod headers $ sudo service apache2 restartしました。(Ubuntu13.10です。)
<VirtualHost *:80> ServerName xxx.yyy.com DocumentRoot /xxx/yyy/public <Directory '/xxx/yyy/public'> AllowOverride all Require all granted </Directory> </VirtualHost>
sudo fluent-gem install fluent-plugin-mongo
<source> type tail format apache2 path /var/log/apache2/access.log pos_file /var/log/fluent/apache2.access_log.pos tag mongo.apache.access </source> <match mongo.apache.access> type mongo database fluent collection apache.access </match>4. 確認
$ sudo fluentdブラウザから適当にアクセスして DB => fluent, コレクション => apache.access を確認。
$ sudo apt-get install libapache2-mod-rpaf $ sudo a2enmod rpaf $ sudo service apache2 restart2. http://wiki.nginx.org/FullExample の proxy_conf の通りに /usr/local/nginx/conf/proxy.conf を作成します。
proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffers 32 4k;3. http://wiki.nginx.org/FullExample の nginx.conf のように proxy.conf を include します。
<IfModule mod_rpaf.c>を
<IfModule mod_rpaf-2.0.c>に変更。
location ~ .*\.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG|swf|SWF|css|CSS|js|JS|ico|ICO) { root /var/www/; }参考:
new WebSocket("ws://example.com:1337");のようにポート番号を指定しますが、これを消したいなーと。
$ wget http://nginx.org/download/nginx-1.3.16.tar.gz $ tar xzvf nginx-1.3.16.tar.gz $ cd nginx-1.3.16/ $ ./configure $ make $ sudo paco -D make install $ nginx -v nginx version: nginx/1.3.163. /usr/local/nginx/conf/nginx.conf を編集
$ diff /usr/local/nginx/conf/nginx.conf.default /usr/local/nginx/conf/nginx.conf 42a43,49 > location /socket/ { > proxy_pass http://127.0.0.1:1337; > proxy_http_version 1.1; > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection "upgrade"; > } > 43a51,52 > proxy_pass http://127.0.0.1:8000; >4. Nginxを起動
$ sudo nginx # 停止は以下 $ sudo nginx -s stop無事、JSで以下の形で接続出来ました。
new WebSocket("ws://example.com/socket/");その他、設定すべき項目は有るのかもしれませんが、とりあえず、最小限の手順はこんな感じなのかなと。
<VirtualHost *:80>を
<VirtualHost *:8000>に変更。
Listen 80を
Listen 8000に変更。
$ sudo service apache2 restart
$ sudo a2enmod rewrite2. /etc/apache2/sites-available/default の修正
<Directory /var/www/> # 省略 AllowOverride None # 省略 </Directory>を
<Directory /var/www/> # 省略 AllowOverride All # 省略 </Directory>に変更。
$ sudo service apache2 restart
[error] an unknown filter was not added: PHPあまり情報も無かったんですが、とりあえず原因の箇所をコメントアウト。。。
$ diff /etc/apache2/mods-available/php5filter.conf.20130325 /etc/apache2/mods-available/php5filter.conf 3,4c3,4 < SetInputFilter PHP < SetOutputFilter PHP --- > # SetInputFilter PHP > # SetOutputFilter PHP参考:
$ sudo apt-get autoremove php5 libapache2-mod-php5 php-pear--
$ cd ~/tmp/src/ $ wget http://jp2.php.net/get/php-5.4.10.tar.gz/from/jp1.php.net/mirror -O php-5.4.10.tar.gz $ tar xfvz php-5.4.10.tar.gz $ cd php-5.4.10/ $ './configure' \ '--prefix=/usr/local/php/php-5.4.10' \ '--with-apxs2=/usr/bin/apxs2' \ '--enable-mbstring' \ '--with-mysql' \ '--with-mysqli' \ '--with-pdo-mysql' \ '--with-xsl' \ '--with-mcrypt' \ '--enable-pcntl' \ '--with-curl' \ '--with-zlib' \ '--with-openssl' $ make $ sudo paco -D make install* オプションについては別途まとめようと思っています。とりあえずスカスカです。。。
$ sudo vim /usr/local/php/php-5.4.10/lib/php.ini # 以下を記述 date.timezone="Asia/Tokyo"3. パスを通す
# シンボリックリンクを作成 $ sudo ln -s /usr/local/php/php-5.4.10 /usr/local/php/latest $ vim ~/.bashrc # ~/.bashrcに以下を追記 PATH=/usr/local/php/latest/bin:$PATH alias sudo="sudo env PATH=$PATH" # 反映 $ source ~/.bashrc* "alias sudo"の箇所については、以下を参考にさせて頂きました。
$ php -v PHP 5.4.10 (cli) (built: Jan 2 2013 03:26:39) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies $ pear version PEAR Version: 1.9.4 PHP Version: 5.4.10 Zend Engine Version: 2.4.0 Running on: Linux localhost 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5 17:42:16 UTC 2012 x86_645. Apacheをリスタート
$ sudo service apache2 restart6. ブラウザから確認
# チャンネルを更新 $ sudo pear update-channels # PEARをアップグレード $ sudo pear upgrade -a PEAR # パッケージをアップグレード $ sudo pear upgrade-all # 新規チャネルを自動的に探す $ sudo pear config-set auto_discover 1 # キャッシュをクリア $ sudo pear clear-cache
$ sudo apt-get update $ sudo apt-get upgrade -y $ sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev wget curl git-core openssh-server redis-server postfix checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev* Postfix関係で、 "General type of mail configuration:"は"Internet Site"を選択しました。
$ python --version Python 2.7.3* 2.5以上が必要とのことです。また、3.xは非サポートとのことです。
$ sudo adduser \ --system \ --shell /bin/sh \ --gecos 'Git Version Control' \ --group \ --disabled-password \ --home /home/git \ git $ sudo adduser --disabled-login --gecos 'GitLab' gitlab $ sudo usermod -a -G git gitlab $ sudo -u gitlab -H ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa5. Gitoliteのインストールと設定
$ cd /home/git $ sudo -u git -H git clone -b gl-v320 https://github.com/gitlabhq/gitolite.git /home/git/gitolite $ sudo -u git -H mkdir /home/git/bin $ sudo -u git -H sh -c 'printf "%b\n%b\n" "PATH=\$PATH:/home/git/bin" "export PATH" >> /home/git/.profile' $ sudo -u git -H sh -c 'gitolite/install -ln /home/git/bin' $ sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub $ sudo chmod 0444 /home/git/gitlab.pub $ sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub" $ sudo chmod 750 /home/git/.gitolite/ $ sudo chown -R git:git /home/git/.gitolite/ $ sudo chmod -R ug+rwXs,o-rwx /home/git/repositories/ $ sudo chown -R git:git /home/git/repositories/* 以下の"example.com"は適切な値に置換して下さい。
$ echo "Host localhost StrictHostKeyChecking no UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config $ echo "Host example.com StrictHostKeyChecking no UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config* 以下、sshのポートを変更していると、"ssh: connect to host localhost port 22: Connection refused"のエラーが出ます。その場合、"ssh://git@localhost:[ポート番号]/gitolite-admin.git"の形式にして下さい。( https://github.com/gitlabhq/gitlabhq/issues/1063#issuecomment-9956749 より。)
$ sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin $ sudo rm -rf /tmp/gitolite-admin6. MySQLのインストール(phpMyAdminは不要)
$ mysql -u root -p mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab'; mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; mysql> \q $ sudo -u gitlab -H mysql -u gitlab -p -D gitlabhq_production mysql> \q8. GitLabのインストールと設定
$ cd /home/gitlab $ sudo -u gitlab -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab $ cd /home/gitlab/gitlab $ sudo -u gitlab -H git checkout 4-0-stable $ cd /home/gitlab/gitlab $ sudo -u gitlab -H cp config/gitlab.yml.example config/gitlab.yml $ sudo chown -R gitlab log/ $ sudo chown -R gitlab tmp/ $ sudo chmod -R u+rwX log/ $ sudo chmod -R u+rwX tmp/ $ sudo -u gitlab -H cp config/unicorn.rb.example config/unicorn.rb* 以下、"localhost"を実際のドメイン名に書き換えます。
$ sudo -u gitlab -H vim config/gitlab.yml9. GitLab用のDB(Mysql)設定
$ sudo -u gitlab cp config/database.yml.mysql config/database.yml10. Gemパッケージのインストール(MySQLの場合)
$ cd /home/gitlab/gitlab $ sudo gem install charlock_holmes --version '0.6.9' $ sudo -u gitlab -H bundle install --deployment --without development test postgres11. Gitの設定
$ sudo -u gitlab -H git config --global user.name "GitLab" $ sudo -u gitlab -H git config --global user.email "gitlab@localhost"12. GitLabのHook設定
$ sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive $ sudo chown git:git /home/git/.gitolite/hooks/common/post-receive13. DBの初期化
$ sudo -u gitlab -H bundle exec rake gitlab:app:setup RAILS_ENV=production* sshのポートを変更していると、"ssh: connect to host localhost port 22: Connection refused"のエラーが出ます。その場合、/home/gitlab/.ssh/configを編集します。
$ sudo -u gitlab vim /home/gitlab/.ssh/config-- /home/gitlab/.ssh/config --
Host localhost Port [ポート番号]14. 初期化スクリプトのインストールとGitLabの起動
$ sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/ $ sudo chmod +x /etc/init.d/gitlab $ sudo update-rc.d gitlab defaults 21 $ sudo service gitlab start15. ステータスの確認
$ sudo -u gitlab -H bundle exec rake gitlab:env:info RAILS_ENV=production $ sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production16. ApacheとPassengerのインストール(RubyとBundlerはインストール済)
$ sudo vim /etc/apache2/sites-available/gitlab-- /etc/apache2/sites-available/gitlab --
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18 #PassengerRuby /usr/local/bin/ruby RailsBaseURI /gitlab18. Apacheの設定反映
$ sudo ln -s /home/gitlab/gitlab/public /var/www/gitlab $ sudo a2ensite gitlab $ sudo service apache2 reload
$ sudo apt-get install -y apache2 libcurl4-openssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev $ sudo gem install passenger $ sudo passenger-install-apache2-module
-------------------------------------------- The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18 PassengerRuby /usr/local/bin/ruby After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration! Press ENTER to continue. -------------------------------------------- Deploying a Ruby on Rails application: an example Suppose you have a Rails application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: <VirtualHost *:80> ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public <Directory /somewhere/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/doc/Users guide Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
$ sudo apt-get update $ sudo apt-get upgrade -y $ sudo apt-get install -y libyaml-dev libncurses5-dev libgdbm-dev libssl-dev libreadline-dev tk-dev zlib1g-dev libmysqld-dev libmagickcore-dev libmagickwand-dev apache2-dev paco2. MySQLのインストール(phpMyAdminは不要)
$ sudo vim /etc/mysql/conf.d/characterset.cnf-- characterset.cnf --
[client] default-character-set=utf8 [mysqld] character-set-server=utf8
$ sudo service mysql restart4-2. MySQLの設定確認
$ mysql -u root -p mysql> show variables like 'character_set%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) mysql> \q5. Redmine用のMySQLデータベースとユーザを作成
$ mysql -u root -p mysql> create database redmine default character set utf8; mysql> grant all on redmine.* to redmine@localhost identified by 'redmine'; mysql> flush privileges; mysql> \q6. Redmine(2.2.0)のインストール
$ cd ~/tmp $ wget http://rubyforge.org/frs/download.php/76627/redmine-2.2.0.tar.gz $ tar xfvz redmine-2.2.0.tar.gz $ sudo mv redmine-2.2.0 /usr/local/ $ sudo ln -s /usr/local/redmine-2.2.0 /usr/local/redmine7. データベースへの接続設定
$ sudo vim /usr/local/redmine/config/database.yml-- database.yml --
production: adapter: mysql2 database: redmine host: localhost username: redmine password: "redmine" encoding: utf88. メールサーバへの接続設定
$ sudo vim /usr/local/redmine/config/configuration.yml-- configuration.yml --
production: email_delivery: delivery_method: :smtp smtp_settings: address: "localhost" port: 25 domain: 'example.com'9. Gemパッケージのインストール
$ cd /usr/local/redmine $ bundle install --without development test postgresql sqlite10. Redmineの初期設定とデータベースのテーブル作成
$ rake generate_secret_token $ RAILS_ENV=production rake db:migrate11. ApacheとPassengerのインストール(RubyとBundlerはインストール済)
$ sudo vim /etc/apache2/sites-available/redmine-- /etc/apache2/sites-available/redmine --
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18 #PassengerRuby /usr/local/bin/ruby RailsBaseURI /redmine13. Apacheの設定反映
$ sudo ln -s /usr/local/redmine/public /var/www/redmine $ sudo a2ensite redmine $ sudo service apache2 reload14. [ベースURL]/redmine にアクセス
$ sudo apt-get update $ sudo apt-get upgrade -y $ sudo apt-get install -y jenkins(2)
$ sudo vim /etc/default/jenkins-- /etc/default/jenkins --
JAVA_ARGS="-Dfile.encoding=utf-8" ... JENKINS_ARGS="--webroot=$JENKINS_RUN/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --preferredClassLoader=java.net.URLClassLoader --prefix=/jenkins"(3)
$ sudo service jenkins restart(4)
$ sudo apt-get install -y apache2(5)
$ sudo a2enmod proxy $ sudo a2enmod proxy_http $ sudo vim /etc/apache2/sites-available/jenkins-- /etc/apache2/sites-available/jenkins --
ProxyPass /jenkins http://xxx.xxx.xxx.xxx:8080/jenkins ProxyPassReverse /jenkins http://xxx.xxx.xxx.xxx:8080/jenkins(6)
$ sudo a2ensite jenkins $ sudo service apache2 restart(7)
sudo apt-get install -y ttf-umefontJenkinsのシステム情報の"java.home"の"lib"に移動します。
cd /usr/lib/jvm/java-6-openjdk-i386/jre/libフォントを配置します。
sudo mkdir -p fonts/fallback cd fonts/fallback/ sudo ln -s /usr/share/fonts/truetype/horai-umefont/ume-pgc4.ttfJenkinsを再起動します。
sudo service jenkins restart
$ sudo apt-get install -y apache2 php5 libapache2-mod-php5 php-pear $ sudo /etc/init.d/apache2 restart $ php --version PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies