Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@sota

【備忘】ubuntu+apache2+php7(docker) on centOS6

More than 1 year has passed since last update.

前提

vagrant+censos6+docker installは済

ubuntuのインストール

docker pull ubuntu:latest

ubuntuの起動

docker run -it -p 8080:80 --name SOMETHING_NAME ubuntu /bin/bash

ubuntuの初期設定

apt update
# vim
apt install vim

# 日本語化
apt install language-pack-ja-base language-pack-ja
locale-gen
echo export LANG=ja_JP.UTF-8 >> ~/.profile
source ~/.profile

# php
apt install software-properties-common #これないとadd-apt-repoが使えない
add-apt-repository ppa:ondrej/php
apt update
apt install php7.2 php7.2-common php7.2-cli php7.2-fpm php7.2-mysql php7.2-dev php7.2-mbstring php7.2-zip

# apache
apt install apache2
apt install libapache2-mod-php7.2 #これないとapache+phpが使えない

# redis
apt install redis-server
apt install php-redis

virtualHostの設定

touch /etc/apache2/sites-available/vhost_XXX.conf

<VirtualHost *:80>
    ServerName 192.168.0.11:8080
    ServerAdmin webmaster@virtual.host
    DocumentRoot /var/www/html_XXX
    ErrorLog /var/log/apache2/virtual.host.error.log
    CustomLog /var/log/apache2/virtual.host.access.log combined
    LogLevel warn
</VirtualHost>

あとは/var/www/html_xxx/info.phpとかでphpInfoでも出してみる

詰まりどころめも

vagrantの中のdockerの中のapacheにアクセスしたいがどうしたら

dockerのポートフォワードで解決

vimが文字化け

デフォで日本語使えるとか甘え

apache起動したもののphpが生テキストになる

apache2に拡張モジュールとしてphp7モジュールが必要だった

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?