@nginx

@nginx

@フォロワー #2

nginxでrubyのcgiを動かせるようにする @LNMP @nginx

lujian 質問投稿 • 2017-05-01 13:32 • @フォロワー #0 • 0 回答 • 3711 Views

LNMP環境のインストールについて @php @MariaDB @MySQL @LNMPA @LNMP @nginx @linux

lujian @回答 • 2014-08-07 12:13 • @フォロワー #1 • 1 回答 • 4742 Views

[Centos]Nginx自動起動の設定について @code @nginx

iQi @回答 • 2014-08-05 13:35 • @フォロワー #2 • 1 回答 • 3432 Views

nginxで502 bad gatewayエラーの対処法について @nginx

iQi @回答 • 2014-07-27 14:24 • @フォロワー #2 • 1 回答 • 10472 Views

NginxにCache[ngx_cache_purge]機能の追加について @LNMP @code @nginx

iQi @回答 • 2014-07-02 17:52 • @フォロワー #3 • 1 回答 • 2894 Views

nginxのhttp_geoip_moduleで国別アクセス制限の対応方法について @LNMP @code @nginx

iQi @回答 • 2014-07-02 17:30 • @フォロワー #3 • 1 回答 • 3455 Views

LNMP環境のNginxなどのバージョンアップ方法について @nginx @LNMPA @LNMP @linux

Lubo @回答 • 2014-06-10 13:34 • @フォロワー #1 • 1 回答 • 2814 Views

nginxでssl設定をする方法について @ssl @nginx

iQi @回答 • 2014-06-09 21:32 • @フォロワー #2 • 1 回答 • 2429 Views

Nginxの起動停止について @nginx

iQi @回答 • 2014-06-09 20:40 • @フォロワー #2 • 1 回答 • 2249 Views

CentOS6.xにてnginxの最新版をインストールする手順について @centos @nginx

iQi @回答 • 2014-06-09 20:38 • @フォロワー #2 • 1 回答 • 2465 Views

さらに...
2

{ 賛成 }: Lubo lujian

NginxのWebサーバーを利用する場合、WordpressのNginx Confの書き方は下記となります。

{{{
server
{
listen 80;
serv...

すべて表示する »
NginxのWebサーバーを利用する場合、WordpressのNginx Confの書き方は下記となります。

{{{
server
{
listen 80;
server_name blog.jp.ai;
index index.html index.htm index.php;
root /home/blog;

location / {
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}

location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}

location /status {
stub_status on;
access_log off;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*\.(js|css)?$
{
expires 12h;
}

}

}}}

ポイントとして、下記のコード内容を追加することです。

{{{
location / {
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
}}}

また、質問があれば遠慮なく教えてください。
0

{ 賛成 }:

GeoIP更新用シェルを作成
{{{
# cd /tmp
# wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
# tar -zxvf GeoIP.tar.gz
# cd Geo...

すべて表示する »
GeoIP更新用シェルを作成
{{{
# cd /tmp
# wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
# tar -zxvf GeoIP.tar.gz
# cd GeoIP-1.4.8
# yum install zlib-devel
# ./configure
# make
# make install

# echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf

# ldconfig
# ldconfig -v | less

# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/local/share/GeoIP/GeoIP.dat.gz
# gunzip /usr/local/share/GeoIP/GeoIP.dat.gz

}}}

Nginx Compile
{{{
# ./configure --without-http_empty_gif_module --with-poll_module --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-http_geoip_module

# make
# make install
※LNMPでインストールする場合、upgrade_nginx.shに「--with-http_geoip_module」を追加してから「./upgrade_nginx.sh」実行してください。
}}}

Nginx設定
{{{
### SET the path to the .dat file used for determining the visitor's country from the IP-address ###
geoip_country /usr/local/share/GeoIP/GeoIP.dat;

### SET FASTCGI Variables ###
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;

}}}
{{{
# /usr/local/nginx/sbin/nginx -s reload
}}}

PHP Test Script
{{{
<html>
<head>
<title>What is my IP address - determine or retrieve my IP address</title>
</head>
<body>
<?php
if (getenv(HTTP_X_FORWARDED_FOR)) {
$pipaddress = getenv(HTTP_X_FORWARDED_FOR);
$ipaddress = getenv(REMOTE_ADDR);
echo "Your Proxy IP address is : ".$pipaddress. " (via $ipaddress) " ;
} else {
$ipaddress = getenv(REMOTE_ADDR);
echo "Your IP address is : $ipaddress";
}
$country = getenv(GEOIP_COUNTRY_NAME);
$country_code = getenv(GEOIP_COUNTRY_CODE);
echo "<br/>Your country : $country ( $country_code ) ";
?>
</body>
</html>
}}}
0

{ 賛成 }:

下記のリンクにて「ngx_cache_purge-2.1」をDownload
http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz

Nginx再インストール
{{{
./configure --wi...

すべて表示する »
下記のリンクにて「ngx_cache_purge-2.1」をDownload
http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz

Nginx再インストール
{{{
./configure --without-http_empty_gif_module --with-poll_module --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --add-module=../ngx_cache_purge-2.1

make
make install

※LNMPでインストールする場合、upgrade_nginx.shに「--add-module=../ngx_cache_purge-2.1」を追加してから「./upgrade_nginx.sh」実行してください。
}}}

{{{
/usr/local/nginx/sbin/nginx -s reload
}}}

Example configuration:
{{{
proxy_cache_path /tmp/cache keys_zone=tmpcache:10m;

location / {
proxy_pass http://127.0.0.1:8000;
proxy_cache tmpcache;
proxy_cache_key $uri$is_args$args;
proxy_cache_purge PURGE from 127.0.0.1;
}
}}}
0

{ 賛成 }:

1.502エラーが発生する一番多い原因は、「/usr/local/php/sbin/php-fpm 」が起動していない、または存在していないことが多いです。「/usr/local/php/sbin/php-fpm 」が起動しているか、またはインストールしている...

すべて表示する »
1.502エラーが発生する一番多い原因は、「/usr/local/php/sbin/php-fpm 」が起動していない、または存在していないことが多いです。「/usr/local/php/sbin/php-fpm 」が起動しているか、またはインストールしていることを確認してください。
2. 「/usr/local/php/etc/php-fpm.conf」のmax_childrenデフォルトが5で、リソースが足りない場合、502エラーになります。メモリーリソースが可能限り、max_childrenが多めに設定してください。例えば、4gの場合、50とか。
3. php Timeoutエラー。この場合、「/usr/local/php/etc/php.ini 」のmax_execution_timeに「300」を設定すれば、解決になります。
4. その他、Disk容量不足とか、502エラーの原因です。具的にLogを確認するうえ、判断してください。
5. また、502エラーを自動判断し、「php-fpm」が自動再起動できるScript(502.sh)を設定すれば、万が一502エラーを発生することを回避することができます。
502.sh
{{{
#!/bin/sh
#/usr/bin/php -q /etc/cron.daily.rsync/502.sh

#!/bin/bash
CheckURL="http://www.test.com"

STATUS_CODE=`curl -o /dev/null -m 20 --connect-timeout 20 -s -w %{http_code} $CheckURL`
echo "$CheckURL Status Code:\t$STATUS_CODE"
if [ "$STATUS_CODE" = "502" ]; then
# echo "$CheckURL Status Code:\t$STATUS_CODE"
/etc/init.d/php-fpm restart
fi
}}}
[www.test.com]を自分サイトURLに変更してください。
また、自動実行できるように「/etc/crontab」に下記の情報を追加してください。
例えば:
{{{
# restart-php-fpm
*/3 * * * * root /etc/cron.daily.rsync/502.sh
}}}
0

{ 賛成 }:

Nginx自動起動の設定について
{{{
chkconfig nginx on
}}}
Nginx自動起動を止めることについて、
{{{
chkconfig nginx off
}}}

{{{
chkconfig --list
chkconfig --add...

すべて表示する »
Nginx自動起動の設定について
{{{
chkconfig nginx on
}}}
Nginx自動起動を止めることについて、
{{{
chkconfig nginx off
}}}

{{{
chkconfig --list
chkconfig --add ***
chkconfig --del ***
}}}
0

{ 賛成 }:

管理コマンド:
————————
{{{
LNMP:/root/lnmp {start|stop|reload|restart|kill|status}
LNMPA:/root/lnmpa {start|stop|reload|restart|kill|sta...

すべて表示する »
管理コマンド:
————————
{{{
LNMP:/root/lnmp {start|stop|reload|restart|kill|status}
LNMPA:/root/lnmpa {start|stop|reload|restart|kill|status}
Nginx:/etc/init.d/nginx {start|stop|reload|restart}
MySQL:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}
MariaDB:/etc/init.d/mariadb {start|stop|restart|reload|force-reload|status}
PHP-FPM:/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}
PureFTPd:/etc/init.d/pureftpd {start|stop|restart|kill|status}
Apache:/etc/init.d/httpd {start|stop|restart|graceful|graceful-stop|configtest|status}
}}}

ステータス確認:
————————
{{{
vhost:/root/vhost.sh
phpinfo:http://yourIP/phpinfo.php
PHPMyAdmin:http://yourIP/phpmyadmin/
PHP:http://yourIP/p.php
PureFtp:http://yourIP/ftp/
Xcache:http://yourIP/xcache/
Zend Opcache:http://yourIP/ocp.php
}}}

LNMP File Location
————————————————
{{{
Nginx:/usr/local/nginx/
MySQL:/usr/local/mysql/
MariaDB:/usr/local/mariadb/
PHP:/usr/local/php/
PHPMyAdmin:/home/wwwroot/default/phpmyadmin/
site default location:/home/wwwroot/default/
Nginx Log:/home/wwwlogs/
}}}

LNMP Config File Location
————————————————
{{{
Nginx:/usr/local/nginx/conf/nginx.conf
MySQL/MariaDB:/etc/my.cnf
PHP:/usr/local/php/etc/php.ini
PureFtpd:/usr/local/pureftpd/pure-ftpd.conf
PureFtpd MySQL:/usr/local/pureftpd/pureftpd-mysql.conf
Apache:/usr/local/apache/conf/httpd.conf
}}}

support
————————
公式サイト:http://lnmp.jp.ai/
0

{ 賛成 }:

Nginxとは、処理性能・高い並行性・メモリ使用量の小ささに焦点を当てて開発されているフリーかつオープンソースのWebサーバである。

NGINXは大規模なビジネス向けにこの成功を手にした。多数の接続を比較的少ないメモリ量で処理できる設計、Apacheと同じく...

すべて表示する »
Nginxとは、処理性能・高い並行性・メモリ使用量の小ささに焦点を当てて開発されているフリーかつオープンソースのWebサーバである。

NGINXは大規模なビジネス向けにこの成功を手にした。多数の接続を比較的少ないメモリ量で処理できる設計、Apacheと同じくIISに比べてコストが安いことがこれを支えている。いわゆるWeb2.0サービスは、Apacheではスケーラビリティの問題、IISではコストの問題に直面する。NGINXはこういったスケーラビリティの柔軟性で勝っている。

公式サイト:http://nginx.org/
wiki:http://wiki.nginx.org/
日本Nginx Q&A:http://nginx.jp.ai/
0

{ 賛成 }:

LNMP環境(Linux+Nginx+Mysql+Php)を簡単にインストールする方法について、下記のリンクを御参照ください。
http://lnmp.jp.ai/question/175
※LNMP環境を構築するなら、上記のやり方がおすすめです。

Ngin...

すべて表示する »
LNMP環境(Linux+Nginx+Mysql+Php)を簡単にインストールする方法について、下記のリンクを御参照ください。
http://lnmp.jp.ai/question/175
※LNMP環境を構築するなら、上記のやり方がおすすめです。

Nginxのみをインストールする場合、下記の内容となります。
###公式ページはここ。
http://nginx.org/en/linux_packages.html#stable

###「CentOS 6」ってリンクのURL:
http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

###CentOSにてリポジトリを登録
先ほど取得したURLを使って、yumリポジトリをCentOSに登録。

# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
下記ファイルが/etc/yum.repos.d/配下につくられる。

nginx.repo
{{{
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
}}}
nginxをyumでインストール
{{{
yum -y install nginx
}}}

バージョン確認。
{{{
nginx -v
nginx version: nginx/1.4.4
}}}

nginxを起動
{{{
/etc/init.d/nginx start
}}}

nginxを再起動
{{{
/etc/init.d/nginx restart
}}}

nginxを停止
{{{
/etc/init.d/nginx stop
}}}

nginx conf設定ファイルをLoad
{{{
/etc/init.d/nginx reload
}}}
0

{ 賛成 }:

nginx で SSL 設定をするのは、簡単です。
サーバ証明書と秘密鍵がすでにあるなら、confファイル に以下の設定を追加するだけでおっけ。
{{{
server {
:
listen 443 default ssl;
ssl on...

すべて表示する »
nginx で SSL 設定をするのは、簡単です。
サーバ証明書と秘密鍵がすでにあるなら、confファイル に以下の設定を追加するだけでおっけ。
{{{
server {
:
listen 443 default ssl;
ssl on;
# サーバ証明書(サーバ証明書に中間CA証明書を連結したもの)
ssl_certificate /usr/local/nginx/conf/cert.pem;
# 秘密鍵
ssl_certificate_key /usr/local/nginx/conf/cert.key;
:
}
}}}
その後、nginx を再起動してやればおっけ。
{{{
/etc/init.d/nginx restart
}}}
または、
{{{
/etc/init.d/nginx reload
}}}

詳細について、公式サイトへ
http://nginx.org/ja/docs/http/configuring_https_servers.html
0

{ 賛成 }:

nginxを起動
{{{
/etc/init.d/nginx start
}}}

nginxを再起動
{{{
/etc/init.d/nginx restart
}}}

nginxを停止
{{{
/etc/init.d/nginx stop
}}}

ng...

すべて表示する »
nginxを起動
{{{
/etc/init.d/nginx start
}}}

nginxを再起動
{{{
/etc/init.d/nginx restart
}}}

nginxを停止
{{{
/etc/init.d/nginx stop
}}}

nginx conf設定ファイルをLoad
{{{
/etc/init.d/nginx reload
}}}
さらに...
処理性能・高い並行性・メモリ使用量の小ささに焦点を当てて開発されているフリーかつオープンソースのWebサーバである。

NGINXは大規模なビジネス向けにこの成功を手にした。多数の接続を比較的少ないメモリ量で処理できる設計、Apacheと同じくIISに比べてコストが安いことがこれを支えている。いわゆるWeb2.0サービスは、Apacheではスケーラビリティの問題、IISではコストの問題に直面する。NGINXはこういったスケーラビリティの柔軟性で勝っている。

公式サイト:http://nginx.org/
wiki:http://wiki.nginx.org/
日本Nginx Q&A:http://nginx.jp.ai/

@概要

処理性能・高い並行性・メモリ使用量の小ささに焦点を当てて開発されているフリーかつオープンソースのWebサーバである。

NGINXは大規模なビジネス向けにこの成功を手にした。多数の接続を比較的少ないメモリ量で処理できる設計、Apacheと同じくIISに比べ...   ...

@関連

@達人

iQi

@ 2賛成, 0 感謝

lujian

@ 0賛成, 0 感謝

Lubo

@ 0賛成, 0 感謝

@フォロワー #2