基本的な事すぎるけどメモ
所有権移転コマンド
chown -R apache:apache フォルダ名
2013年12月30日月曜日
2013年6月20日木曜日
apacheのリダイレクト設定・バーチャルホストの場合
......中略........
<VirtualHost :80*>
ServerName www.example.jp
Redirect / http://www.example.com/
</VirtualHost>
......中略........
※www.example.jpにアクセスすると,www.example.comに転送される。
2013年6月6日木曜日
VirtualHostの設定・フォルダ飛ばし
test.hogehoge.netのhtmlを直接見に行かせる。
この場合、folder2のディレクトリにindex.htmlなどを入れてテストした。
<VirtualHost *:80>
DocumentRoot /var/www/html/hogehogefolder/folder1/folder2
ServerName hogehoge.com
ServerAlias test.hogehoge.net
Options FollowSymLinks ExecCGI
</VirtualHost>
フォルダ飛ばせていいかんじー
NameVirtualHost *:80がコメントアウト#になってるからはずすね。
この場合、folder2のディレクトリにindex.htmlなどを入れてテストした。
<VirtualHost *:80>
DocumentRoot /var/www/html/hogehogefolder/folder1/folder2
ServerName hogehoge.com
ServerAlias test.hogehoge.net
Options FollowSymLinks ExecCGI
</VirtualHost>
フォルダ飛ばせていいかんじー
NameVirtualHost *:80がコメントアウト#になってるからはずすね。
2013年6月3日月曜日
2013年5月2日木曜日
アクセス時、端末での表示サイト切り分け
.htaccessを編集
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (iPhone|Android.*Mobile|Windows.*Phone) [NC]
RewriteCond %{QUERY_STRING} !mode=pc
RewriteRule ^$ /sp/ [R,L]
</IfModule>
~
~
~
".htaccess" 6L, 193C
CMSとかならプラグインつかうかレスポンシブデザインの方がいいかもね。
MacのJISキーボードで英数と思って入力したらかな入力だった場合の技
例えば
「英数モード」と思って無意識に入力したら「かなモード」だった場合。こーなる。
てst
英語で「test」と打ったつもりが「かなモード」だったため「てst」となった。
ところが、「てst」と打って「Enter」を押して決定する前に「英数キー」を2度押すと…
「てst」→「test」に変換される。2度押せば英数モードになる。便利。
「英数モード」と思って「かなモード」だった場合は、この逆で「かなキー」を2度押す。
また、「てst」と打ってうっかり「Enter」してしまった場合。 (「てst」+「Enter」)
その後に、「英数キー」を2度押すとこーなる。
てsttest == 誤って入力した文字 + 正しく英変換されたされた文字
「英数モード」と思って無意識に入力したら「かなモード」だった場合。こーなる。
てst
英語で「test」と打ったつもりが「かなモード」だったため「てst」となった。
ところが、「てst」と打って「Enter」を押して決定する前に「英数キー」を2度押すと…
「てst」→「test」に変換される。2度押せば英数モードになる。便利。
「英数モード」と思って「かなモード」だった場合は、この逆で「かなキー」を2度押す。
また、「てst」と打ってうっかり「Enter」してしまった場合。 (「てst」+「Enter」)
その後に、「英数キー」を2度押すとこーなる。
てsttest == 誤って入力した文字 + 正しく英変換されたされた文字
2013年5月1日水曜日
iPhoneアプリ・XCODEにて、間違えてないないのにThread1 :signal SIGABRTが出てデバックができない場合
Thread1 :signal SIGABRT
UIパーツとコードを関連付けたボタンやラベルなど怪しそうなのを右クリックして黒いミニ画面の×マークを削除したり、ViewController.mとかにゴミがないかチェック。
それでもダメな場合は、UIパーツを削除してもう一度ドラッグと関連づけをする。
これでおk
Thread1 :signal SIGABRTは、おそらく、UIパーツと関連づけしたコードを書き直したりするとなっている気がする。関連付けを消してもゴミ残るわ。
UIパーツとコードを関連付けたボタンやラベルなど怪しそうなのを右クリックして黒いミニ画面の×マークを削除したり、ViewController.mとかにゴミがないかチェック。
それでもダメな場合は、UIパーツを削除してもう一度ドラッグと関連づけをする。
これでおk
Thread1 :signal SIGABRTは、おそらく、UIパーツと関連づけしたコードを書き直したりするとなっている気がする。関連付けを消してもゴミ残るわ。
2013年4月26日金曜日
iPhoneでappstoreでダウンロードしようとするとunknown errorの対処方法
iPhoneの設定で機内モードをON-OFF
設定のstoreでApple IDをダップしてダイアログが出るのでサインアウト後にサインイン
以上
2013年4月21日日曜日
2013年4月7日日曜日
makeコマンドはCentOS6のデフォルトにない
yum install make -y
で、makeコマンドを入力できるようにインストールする。
make server.keyを使うときに使用した。
で、makeコマンドを入力できるようにインストールする。
make server.keyを使うときに使用した。
2013年4月6日土曜日
wgetでWordpressをダウンロードして解凍
ディレクトリを指定
ダウンロード
ダウンロード
wget http://ja.wordpress.org/wordpress-3.5.1-ja.tar.gz
解凍
tar xvzf wordpress-3.5.1-ja.tar.gz
ダウンロードするWordpressのバージョンを確認してから作業すること。
Joomlaのプラグインが調子悪いのでBasic認証
Cent OS6でjoomlaの場合
新しく.htpasswdファイルを作成する場合
htpasswd -c -b /etc/httpd/conf/.htpasswd user1 hogehoge
<htpasswd -c -b /etc/httpd/conf/.htpasswd ユーザ名 パスワード>
<htpasswd -c -b /etc/httpd/conf/.htpasswd ユーザ名 パスワード>
既にある.htpasswdファイルにユーザを追加する場合
htpasswd -b /etc/httpd/conf/.htpasswd user2 hogehoge
vi /etc/httpd/conf/.htpasswdで確認 ユーザ名とパスが明記されているはず
:q
vi /etc/httpd/conf/.htpasswdで確認 ユーザ名とパスが明記されているはず
:q
vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html/hogehoge/administrator"> ← Basic認証を設定したい(一般的なディレクトリ)
AuthUserFile /etc/httpd/conf/.htpasswd ← 認証ユーザーの設定ファイルのパス
AuthGroupFile /dev/null
AuthName "Basic Auth"
AuthType Basic
Require valid-user
</Directory>
:wqして...
再起動
:wqして...
再起動
/etc/init.d/httpd restart
faviconのキャッシュクリア、SAFARIの場合
WebpageIcons.dbを捨てる
ライブラリ/Safari/WebpageIcons.db
ライブラリ/icons/にもWebpageIcons.dbがあるが、iconsの中のWebpageIcons.dbを捨てるだけではキャッシュはクリアされなかったので、ライブラリ/Safari/WebpageIcons.dbが正解と思われる。
Safariを再起動すればキャッシュクリア完了。
2013年4月5日金曜日
JoomlaでURLリライト設定
JoomlaでURLリライト設定を「はい」にしたときの .htaccess の設定項目メモ
以下の3つを確認
Options +FollowSymLinks ←コメントアウトしない
RewriteEngine On ←コメントアウトしない
# RewriteBase / ←コメントアウトする
うちのサーバは、これで出来た。
違う場合もあるようなので注意
2013年3月30日土曜日
2013年3月29日金曜日
なれたら7分で出来るCentOS6での環境設定
グリーン文字をコピペコマンド
yum install wget -y
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
(最新でインストールhttp://dl.fedoraproject.org/pub/epel/6/x86_64/)←(epel-release- で検索)
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
(最新でインストールhttp://pkgs.repoforge.org/rpmforge-release/)←(epel-release- で検索)
上記のリポジトリの追加
rpm -Uvh epel-release-6-8.noarch.rpm remi-release-6.rpm rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
vi /etc/yum.repos.d/epel.repo でリポジトリをいったん無効化。
------------------------------------------------------------------------------------------------------------
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0 ← 1を0に変更
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
------------------------------------------------------------------------------------------------------------
vi /etc/yum.repos.d/rpmforge.repo でリポジトリをいったん無効化。
------------------------------------------------------------------------------------------------------------
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled=0 ← 1を0に変更
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
------------------------------------------------------------------------------------------------------------
こっから順序よく
httpdのインストール
yum install httpd -y
起動
/etc/init.d/httpd start
自動起動設定
chkconfig httpd on
phpインストール
yum install php-devel php-mbstring php-mysql php-gd php-mcrypt php-pear php-xml -y
httpd再起動
/etc/init.d/httpd restart
index.phpやphpinfo.phpを作って確認
mysqldのインストール
yum install mysql-server -y
mysqldの起動
/etc/init.d/mysqld start
自動起動設定
chkconfig mysqld on
MySQLの設定
/usr/bin/mysql_secure_installation
Set root password? [Y/n] y
New password:********
Re-enter new password:********
Remove anonymous users? [Y/n]y
Disallow root login remotely? [Y/n]y
Remove test database and access to it? [Y/n]y
Reload privilege tables now? [Y/n] y
httpd再起動
/etc/init.d/httpd restart
php.iniの設定
vi /etc/php.ini
post_max_size = 128M
upload_max_filesize = 128M
:wq
httpd再起動
/etc/init.d/httpd restart
ついでに
vi /etc/httpd/conf/httpd.conf
httpd.confの最後につけたし
<Directory "/var/www/html/">
Options All
AllowOverride All
</Directory>
:wq
httpd再起動
/etc/init.d/httpd restart
確認
chkconfig --list|grep -E "httpd|mysql"
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
サーバ再起動
おしまい
yum install wget -y
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
(最新でインストールhttp://dl.fedoraproject.org/pub/epel/6/x86_64/)←(epel-release- で検索)
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
(最新でインストールhttp://pkgs.repoforge.org/rpmforge-release/)←(epel-release- で検索)
上記のリポジトリの追加
rpm -Uvh epel-release-6-8.noarch.rpm remi-release-6.rpm rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
vi /etc/yum.repos.d/epel.repo でリポジトリをいったん無効化。
------------------------------------------------------------------------------------------------------------
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0 ← 1を0に変更
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
------------------------------------------------------------------------------------------------------------
vi /etc/yum.repos.d/rpmforge.repo でリポジトリをいったん無効化。
------------------------------------------------------------------------------------------------------------
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled=0 ← 1を0に変更
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
------------------------------------------------------------------------------------------------------------
こっから順序よく
httpdのインストール
yum install httpd -y
起動
/etc/init.d/httpd start
自動起動設定
chkconfig httpd on
phpインストール
yum install php-devel php-mbstring php-mysql php-gd php-mcrypt php-pear php-xml -y
httpd再起動
/etc/init.d/httpd restart
index.phpやphpinfo.phpを作って確認
mysqldのインストール
yum install mysql-server -y
mysqldの起動
/etc/init.d/mysqld start
自動起動設定
chkconfig mysqld on
MySQLの設定
/usr/bin/mysql_secure_installation
Set root password? [Y/n] y
New password:********
Re-enter new password:********
Remove anonymous users? [Y/n]y
Disallow root login remotely? [Y/n]y
Remove test database and access to it? [Y/n]y
Reload privilege tables now? [Y/n] y
Thanks for using MySQL!
phpMyAdminのインストール
yum --enablerepo=remi,epel,rpmforge install phpmyadmin -y
mcryptインストール
yum --enablerepo=epel install php-mcrypt -y
httpd再起動
/etc/init.d/httpd restart
phpmyadmin設定ファイル 文字列入力
vi /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'moTpxxCbiWaosjerWgA90j8k'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
:wq
つづき
vi /etc/httpd/conf.d/phpmyadmin.conf
----- ここから ------- オレンジ色付け足す
# Web application to manage MySQL
#
<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from All Allow from ::1
</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/httpd/conf.d/phpmyadmin.conf" 14L, 300C
:wq
------ ここまで ------
/etc/init.d/httpd restart
phpmyadmin設定ファイル 文字列入力
vi /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'moTpxxCbiWaosjerWgA90j8k'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
:wq
つづき
vi /etc/httpd/conf.d/phpmyadmin.conf
----- ここから ------- オレンジ色付け足す
# Web application to manage MySQL
#
<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from All Allow from ::1
</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/httpd/conf.d/phpmyadmin.conf" 14L, 300C
:wq
------ ここまで ------
httpd再起動
/etc/init.d/httpd restart
php.iniの設定
vi /etc/php.ini
post_max_size = 128M
upload_max_filesize = 128M
:wq
httpd再起動
/etc/init.d/httpd restart
ついでに
vi /etc/httpd/conf/httpd.conf
httpd.confの最後につけたし
<Directory "/var/www/html/">
Options All
AllowOverride All
</Directory>
:wq
httpd再起動
/etc/init.d/httpd restart
確認
chkconfig --list|grep -E "httpd|mysql"
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
おしまい
2013年1月6日日曜日
sshのrootログイン無効設定
vi /etc/ssh/sshd_config
PermitRootLogin no コメントアウトしてyesをnoに変更
sshdを再起動
/etc/init.d/sshd restart
sshには次回よりユーザでログインする。
su - コマンドでroot権限が取れる。
ftpユーザ・ディレクトリ制限
rootにて
上書き保存する。 これ大事↓
vi /etc/vsftpd/vsftpd.conf12行目:anonymous_enable=NOに変更 96,97行目:コメント解除(chroot有効) 99行目:コメント解除(chroot_listを指定)
最終行追記:local_root=/var/www/:wq
上書き保存する。 これ大事↓
vi /etc/vsftpd/chroot_listそして とりあえずはなにも入力せずに:wqで保存 最後にsshdの再起動
/etc/init.d/vsftpd restart
こうすると/var/wwwより上には接続できません。 ドキュメントルートは/var/www/html/なので、ブラウザからはアクセスできません。 FTPを自分以外に渡す必要性があるときにも便利ですし、特定ファイルをFTPでしか見れないような形にする意味でも便利
サブドメイン設定
httpd.confに一番下、書き加える
<VirtualHost *>
ServerName test.example.net 追加するサブドメイン
DocumentRoot /var/www/html/cafe1 そのデータのディレクトリ
</VirtualHost>
httpdを再起動
DNSのレーコード設定して終了
初期設定
yum install wget
yum install httpd php mysql-server php-mysql php-mbstring php-gd
yum install php-xml
/etc/init.d/httpd start
chkconfig httpd on
/etc/init.d/mysqld start
mysqladmin -u root password '任意のパスワード'[root@web05 ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.66 Source distribution Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql>exit;
yum install vsftpd
chkconfig vsftpd on
phpMyAdminのインストール
wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
rpm --import RPM-GPG-KEY-EPEL-6
rm -f RPM-GPG-KEY-EPEL-6
vi /etc/yum.repos.d/epel.repo[epel] name=EPEL RPM Repository for Red Hat Enterprise Linux baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/ gpgcheck=1 enabled=0
yum --enablerepo=epel install phpmyadmin<Directory /usr/share/phpMyAdmin/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from All Allow from ::1 </IfModule> </Directory>
/etc/init.d/httpd restartディレクティブ1:ServerTokensの設定 設定方法 httpd.confの Section 1 Global Environment項目の中にある ServerTokens OS 部分をコメントアウトし、すぐ下に「ServerTokens ProductOnly」を追加します。
vi /etc/httpd/conf/httpd.conf
/etc/init.d/httpd restart
chkconfig --list|grep -E "httpd|mysql|vsftpd"httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
yum install unzip
登録:
投稿 (Atom)