忍者ブログ
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

ノートPCで蓋を閉じてもサスペンドにならないようにするには
/etc/systemd/logind.conf

HandleLidSwitch=ignore
とする。

PR
tdiaryをインストールするために、まずrubyをインストールする。

# yum install ruby

gemとかrubyの仕組みがよくわかってなくて、
gemでのtdiaryがうまくインストールできないため、
tdiary.orgから最新バージョンのものを取ってくる。

$ cd ./public_html

$ wget http://www.tdiary.org/download/tdiary-full-v4.0.4.tar.gz
$ mv tdiary-v4.0.4/ ./public_html/diary
$ cd public_html/diary/
$ chmod 755 ./diary/

この状態で、tdiaryにアクセスすると、web上で以下のようなエラーが出る。
Could not find addressable-2.3.6 in any of the sources (Bundler::GemNotFound)

ってことで、bundle install を実行
$ gem install bundler
$ cd /home/hoge/public_html/diary
$ bundle install
この状態で、tdiaryにアクセスすると、web上で以下のようなエラーが出る。
No such file or directory - tdiary.conf (Errno::ENOENT)
これはtdiary.confがないから。
サンプルを元にtdiary.confを作る。
$ cp tdiary.conf.beginner tdiary.conf
これで一応、tdiaryが動く。
.htaccessの設定
AddHandler cgi-script .rb AddType application/xml .rdf <Files "*.rhtml*"> deny from all </Files> <Files "tdiary.*"> deny from all </Files> <Files update.rb> AuthName tDiary AuthType Basic AuthUserFile /home/hoge/.htpasswd Require user hogehoge </Files>

.htpasswd の設定
$ cd
$ htpasswd -c .htpasswd hogehoge
パスワードを2回入れる。

日本語を入力できるようにkkcをインストールする

# yum install ibus-kkc.x86_64

/etc/httpd/conf.d/user.conf
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid.  This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    #UserDir disabled
    UserDir enable
    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    # 
    #UserDir public_html
</IfModule>
#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "/home/*/public_html">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

http.conf を修正
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin webmaster@example.com
ServerName www.example.com:80
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride None
    Require all granted
</Directory>
<Directory "/var/www/html">
    Options Includes ExecCGI FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
<Directory "/var/www/icons">
    Options MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html index.rb index.php
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<IfModule mod_userdir.c>
    UserDir enable
    UserDir public_html
</IfModule>
<Directory "/home/*/public_html/diary.new">
        AllowOverride FileInfo AuthConfig Limit
        Options Includes ExecCGI FollowSymLinks 
        Order allow,deny
        Allow from all
        AddHandler cgi-script .cgi .rb .php .pl
</Directory>
<Directory "/home/*/public_html/diary">
        AllowOverride FileInfo AuthConfig Limit
        Options Includes ExecCGI FollowSymLinks
        Order allow,deny
        Allow from all
        AddHandler cgi-script .cgi .rb .php .pl
</Directory>
<IfModule mime_module>
    TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler cgi-script .cgi .rb .php .pl
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on

VirtualBoxに新しいマシンを追加。
Centos7をインストールする。
とりあえず、メモリは4G、HDDは20G。あとはおまかせでインストール開始。
インストール終了後、一旦仮想PCの電源OFF。

vmwareでの作業
仮想CDからインストール用のISOフィアルを抜く
ネットワークの設定を NAT から ブリッジアダプターに変更

仮想PC(Centos7)での作業
固定IPアドレスを設定

sshdを自動起動させるための設定
# systemctl enable sshd.service

selinuxを停止させる
# cd /etc/selinux/
  #SELINUX=enforcing
  SELINUX=disabled
一回リブート

ネットワークを起動時に生かす
# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
  ONBOOT = no を変更して
  ONBOOT = yes
とする

Firewallの設定を確認、その後、http,httpsを通過させるように設定
# firewall-cmd --list-all-zones
# firewall-cmd --add-service=http --zone=public --permanent
# firewall-cmd --add-service=https --zone=public --permanent

httpd と php と mariadbをインストール
# yum install httpd mod_ssl php php-mysql mariadb-server

httpdとmariadbを起動
# systemctl start httpd.service
# systemctl start mariadb.service
# systemctl enable httpd.service
# systemctl enable mariadb.service 

php.iniファイルを編集
# /etc/php.ini
  mbstring.internal_encoding = UTF-8
  mbstring.http_output = UTF-8
  mbstring.encoding_translation = On

mariadbのファイルを編集
# vi /etc/my.cnf.d/server.cnf
  [mysqld]
  character-set-server=utf8
  skip-character-set-client-handshake

# vi /etc/my.cnf.d/client.cnf
  [client]
  default-character-set=utf8

# vi /etc/my.cnf.d/mysql-clients.cnf
  [mysql]
  default-character-set=utf8

とりあえずここまで。
postfixのmain.cfを編集

relayhost = [xx.yy.auone-net.jp]:587   ←xyはsmtpサーバによって異なる

最終行に追加
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_passwd

smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN

# vi /etc/postfix/smtp_passwd ←新規作成
xx.yy.auone-net.jp a123456789:password ←a123456789 はアカウント passwordは設定したパスワード

# yum -y install cyrus-sasl-plain cyrus-sasl-md5 ←これを入れないと怒られる

# /etc/init.d/saslauthd restart
# /etc/init.d/postfix restart

# mail test@example.com ←テストメールを自分のメールアドレスに送付

# /etc/init.d/dovecot restart

再起動で立ち上がるように設定
# chkconfig saslauthd --level 345 on
# chkconfig postfix --level 345 on
# chkconfig dovecot --level 345 on
 
カレンダー
04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
ブログ内検索
前のページ   次のページ

material:web*citron  template:ゆずろぐ

忍者ブログ [PR]