สวัสดีฉันเป็นมือใหม่ใน nginx ฉันพยายามตั้งค่าบนเซิร์ฟเวอร์ของฉัน (ใช้ Ubuntu 4) ซึ่งมี apache ทำงานอยู่แล้ว
หลังจากapt-get installนั้นฉันพยายามเริ่ม nginx จากนั้นฉันจะได้รับข้อความดังนี้:
Starting nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
นั่นเป็นเหตุผลที่ Apache ใช้พอร์ต 80
จากนั้นฉันพยายามแก้ไขnginx.confฉันอ้างอิงบางบทความดังนั้นฉันจึงเปลี่ยนเป็นดังนี้:
   server {
        listen       8080;
        location / {
         proxy_pass  http://xx.xx.xx.xx:9500;
         proxy_set_header   Host             $host:8080;
         proxy_set_header   X-Real-IP        $remote_addr;
         proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
         proxy_set_header Via    "nginx";
        }
หลังจากบันทึกสิ่งนี้แล้วลองเริ่ม nginx อีกครั้งฉันยังคงได้รับข้อผิดพลาดเหมือนเดิม ฉันไม่สามารถหาโพสต์ที่เกี่ยวข้องเกี่ยวกับเรื่องนี้ได้คนดีๆสามารถทำลายความสว่างได้หรือไม่?
ขอบคุณล่วงหน้า :)
================================================== =======================
ฉันควรโพสต์เนื้อหาทั้งหมดใน conf ที่นี่:
user www-data;
worker_processes  1;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
    # multi_accept on;
}
http {
    include       /etc/nginx/mime.types;
    access_log  /var/log/nginx/access.log;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;
    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
   server {
        listen       81;
        location / {
         proxy_pass  http://94.143.9.34:9500;
         proxy_set_header   Host             $host:81;
         proxy_set_header   X-Real-IP        $remote_addr;
         proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
         proxy_set_header Via    "nginx";
        }
    }
}
 mail {
      See sample authentication script at:
      http://wiki.nginx.org/NginxImapAuthenticateWithApachePhpScript
      auth_http localhost/auth.php;
      pop3_capabilities "TOP" "USER";
      imap_capabilities "IMAP4rev1" "UIDPLUS";
     server {
         listen     localhost:110;
         protocol   pop3;
         proxy      on;
     }
     server {
         listen     localhost:143;
         protocol   imap;
         proxy      on;
     }
 }
โดยทั่วไปฉันไม่ได้เปลี่ยนแปลงอะไรเลยนอกจากการเพิ่มส่วนเซิร์ฟเวอร์